Zafire Posted January 2, 2011 Share Posted January 2, 2011 Hi, i make a script for load vehicles from a mysql tablee.. if works perfectly but now i want to store vehicles id and data or something like that in a gloval array? its possible? something like this car[id][selling] = 0 ... things like that because i want to make functions using foreach and modify things an blabla so i need to store that in arrays.. how to do that? only i need an example.. here is something of my code -- Funcion para Cargar los Vehiculos ---------------------------------------------- function cargarVehiculos() local vehnum = 0 local resultado = mysql_query(sql_connect, "SELECT * FROM vehiculos ORDER BY id ASC") if(resultado) then while true do local row = mysql_fetch_assoc(resultado) if(not row) then break end local vehiculo = createVehicle(row["modelo"], row["x"], row["y"], row["z"]) setVehicleColor(vehiculo, row["color1"], row["color2"], row["color1"], row["color2"]) if(row["encendido"] == "no") then setVehicleEngineState(vehiculo, false) else setVehicleEngineState(vehiculo, true) end if(row["cerrado"] == "no") then setVehicleLocked(vehiculo, false) else setVehicleLocked(vehiculo, true) end vehnum = vehnum + 1 end end return vehnum end ----------------------------------------------------------------------------------- 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