how can I use "for k, j in pairs() do" for 2 arrays in lua?
local blipmarker1 = {
{ x = 10 , y = 5, z = 3 },
{ x = 5, y = 5, z= 3}
}
local blipmarker2 = {
{ x = 100, y= 150, z=30 }
}
function createtext(){
local pos = GetEntityCoords(PlayerPedId(), true)
for k, j in pairs(blipmarker1,blimarker2) do
draw3DText(pos.x, pos.y, pos.z, j.x, j.y, j.z)
end
}
nextto move through 2 arrays together. But i am unsure how the code in you post is expected to behave. Does the loop only run once? because blipmarker2 only has 1 value or does it run twice because blipmarker1 has 2 values and during the second loop blipmarker2 is nilfor _, bm in ipairs{blipmarker1,blimarker2} do for k, j in pairs(bm) do .... end end