AlphaMark Posted November 28, 2013 Share Posted November 28, 2013 Okay so i have this: CrateMarker = createMarker(unpack(BoxPos[math.random(1,3)])) And it creates an big blue marker while i want an cylinder marker. Link to comment
manawydan Posted November 28, 2013 Share Posted November 28, 2013 try CrateMarker = createMarker(unpack(BoxPos[math.random(1,3)]),"cylinder") Link to comment
AlphaMark Posted November 28, 2013 Author Share Posted November 28, 2013 Bad argument @ CrateMarker Link to comment
LiOneLMeSsIShoT Posted November 28, 2013 Share Posted November 28, 2013 Bad argument @ CrateMarker crateMarker = createMarker(unpack(BoxPos[math.random(1,3)]),"cylinder") Error Because: because it was "CreateMarker"...and it hve to be "createMarker" Link to comment
manve1 Posted November 28, 2013 Share Posted November 28, 2013 Bad argument @ CrateMarker crateMarker = createMarker(unpack(BoxPos[math.random(1,3)]),"cylinder") Error Because: because it was "CreateMarker"...and it hve to be "createMarker" the name of what you call it, in this instance 'crateMarker' doesn't mean anything unless you use it in other place of your script. The problem is because createMarker needs at least 3 functions: createMarker(x,y,z) everything else is just the design, but as in your script you got: createMarker(x,_,_,type) by '_' i represent that the arguments don't exists, so that's what you need to fix Link to comment
myonlake Posted November 29, 2013 Share Posted November 29, 2013 manve1, that's just wrong. He already has a table containing all the required arguments to the function. In order to properly split them in corresponding arguments, he has to use 'unpack' Lua function. Therefore the way he performs the function is just right. I wonder if the table is correct however, so this is how it's supposed to be. local BoxPos = { {0, 0, 3}, {0, 5, 3}, {0, 10, 3} } local marker = createMarker(unpack(BoxPos[math.random(1,#BoxPos)])) If it really doesn't work, even though it should, then do it manually by passing in the specific table values in each argument you want to set. Link to comment
manve1 Posted November 29, 2013 Share Posted November 29, 2013 I didn't look at the first post correctly, but I still don't see anything about "table", this time it is my own fault, but for recommendation towards AlphaMark, i would include anything that is used towards the same function. Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 local x, y, z = unpack(BoxPos[math.random(#BoxPos)]) CrateMarker = createMarker(x, y, z, "cylinder") Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now