diegofkda Posted July 2, 2011 Share Posted July 2, 2011 Well, I'm not bad at Lua but I want to know what is a table , I just want to make one because of getVehicleHandling() (or just I want to know how to use it). Link to comment
CowTurbo Posted July 2, 2011 Share Posted July 2, 2011 Tabel is easy thing, where u can store items, arguments, everything what u would like to. With tabel, u can make much more easyly big items, lets make u example. myTabel = {{"Infernus", "0", "0","3"}{"Alpha", "0", "3","3"}} -- So, tabel is now done with Car name, and cords. function createVehicles () for i,v in ipairs ( myTabel ) do -- gets all items in tabel local carID = getVehicleModelFromName(v[1]) local vehicle[i] = createVehicle ( carID, tonumber([v2]), tonumber([v3]), tonumber([v4])) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createVehicles ) Hope it helps a bit u. EDIT: Read that too... http://lua-users.org/wiki/TablesTutorial Link to comment
diegofkda Posted July 2, 2011 Author Share Posted July 2, 2011 Perfect dude, now I know what's a Lua table yay thank you very much \o/. Link to comment
Deltanic Posted July 2, 2011 Share Posted July 2, 2011 getVehicleHandling returns a table indeed. If you do the following: local handlingTable = getVehicleHandling ( veh ) and you want to get the mass value, you usew the following: handlingTable["mass"] the centerOfMass is a bit trickier, as that returns a table itself. So, in order to get the Z position of centerOfMass, use the following: vehicleTable["centerOfMass"][3] -- Numbers: 1 = X, 2 = Y, 3 = Z Yes, a nested table But you ifyou dont want to get a complete table, and just retrieve the mass you could also use this: getVehicleHandling ( veh )["mass"] 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