isa_Khamdan Posted January 24, 2014 Share Posted January 24, 2014 (edited) Hello , I will try to explain my problem I have a Variable named x local x = 1 and another variable name Veh Veh = createVehicle ( 544, x, y, z, rx, ry, rz ) okay so my problem comes here I want to add x to the second Variable name so it will be Veh1 or Veh2 if x was 2.. etc for example local x = 1 Veh(x here) = createVehicle ( 544, x, y, z, rx, ry, rz ) x = x+1 so is it possible to do this? Edited January 24, 2014 by Guest Link to comment
manawydan Posted January 24, 2014 Share Posted January 24, 2014 i think yes, you can use for Link to comment
isa_Khamdan Posted January 24, 2014 Author Share Posted January 24, 2014 Can you explain more? Link to comment
Bonsai Posted January 24, 2014 Share Posted January 24, 2014 Use a table. vehicle = {} vehicle[x] = veh They will be saved like this: vehicle[1] = veh1 vehicle[2] = veh2 Link to comment
Gallardo9944 Posted January 24, 2014 Share Posted January 24, 2014 Untested. Don't forget to put your y,z,rx,ry,rz values though. local vehiclesToCreate = 10 local x = 1 local increment = 1 local vehicles = { } for i=1,vehiclesToCreate do local veh = createVehicle (544,x,y,z,rx,ry,rz) table.insert(vehicles,veh) x = x + increment end outputChatBox(#vehicles.." created!",root,0,255,0) 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