Search the Community
Showing results for tags 'lua table'.
-
Hi. I have some issue and can't really deal with it. I have a table: declaration, initialization... local taxidf = { { } }; taxidf[player] = { player = getPlayerName(player), ped = {}, blip = {}, mark = {}, endblip = {}, endmark = {} }; Then to this table I put some values (one of them is below): local ped = createPed( tonumber( id ), DTM_PTS[startPoint][2], DTM_PTS[startPoint][3], DTM_PTS[startPoint][4] + 0.5 ) table.insert( taxidf[player].ped, { ped } ) No matter what's in these DMTs - I need to sketch the problem... Ped is created indeed. And when I want to receive the data later: I get local ped = taxidf[player].ped; I got a message the table length is 1 but table is nil. So I have a question: how should I take the object from this table? What am I doing wrong? To visualize the output I : outputDebugString("ped : "..tostring(ped)..", len: "..tostring(#ped)..", "..tostring(ped[0])..", "..tostring(ped[1]) ); results: `ped: table : 0af4gf3t len : 0, nil, nil` So ped[0] is null, ped is a table.... what to deal with it?? I just want to have back the object in the exact way I do this. Please some suggestions. My target is to: setTimer( killPed, 60, 1, ped ) --- error: [expected element at arg.1, got table] or setTimer( killPed, 60, 1, ped[1] ) --- error: [expected element at arg.1, got nil] you understand... I can't kill this ped!