Hiding Posted January 31, 2021 Share Posted January 31, 2021 (edited) local narrows = { {8843, 3736.6, -1569, 150.8, 349, 0, 60}, {8843, 3736.7, -1569, 170.6, 348, 180, 60} } function just_a_function() createObject(narrows[1]) createObject(narrows[2]) end // just_a_function() is called in other function It says 'createObject' [expected number at argument 1, got table] Edited January 31, 2021 by Hiding Link to comment
SpecT Posted January 31, 2021 Share Posted January 31, 2021 (edited) You need to specify every element of every row in the table in createObject. Just like this: createObject(narrows[1][1], narrows[1][2], narrows[1][3], narrows[1][4], narrows[1][5], narrows[1][6], narrows[1][7]) Edited January 31, 2021 by SpecT 1 Link to comment
Moderators Patrick Posted January 31, 2021 Moderators Share Posted January 31, 2021 (edited) Hi. You have to unpack values first, because now you pass only a table to createObject. function just_a_function() -- get the values from table local model, x, y, z, rx, ry, rz = narrows[1][1], narrows[1][2], narrows[1][3], narrows[1][4], narrows[1][5], narrows[1][6], narrows[1][7] createObject(model, x, y, z, rx, ry, rz) -- or you can use 'unpack' local model, x, y, z, rx, ry, rz = unpack(narrows[2]) createObject(model, x, y, z, rx, ry, rz) end Edited January 31, 2021 by Patrick 1 Link to comment
Hiding Posted January 31, 2021 Author Share Posted January 31, 2021 Oh, I get it, thank you guys so much!! 1 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