Hello! A few questions about loading data from the database, in my case, for example, transport. But by analogy, in the future I plan to load all the other information from the database.
The code I have written so far:
1. Am I creating the vehicle in the vehicles table correctly and storing the data in elementData? Or should we also use the Vehicle[v.id]['x'] = v.x table to store the data?
vehicle[v.id] = {}
vehicle[v.id]['x'] = v.x
2. Will there be any problems and how convenient it is if I use its id from the database as the transport number and not as it is written in the table 1,2,3..n
for _, v in pairs(result) do
vehicle[v.id] = createVehicle(v.model, v.x, v.y, v.z)
or
for i, v in pairs(result) do
vehicle[i] = createVehicle(v.model, v.x, v.y, v.z)
Sorry for my English.