Jump to content

Problem with Pulling data or something of another


Recommended Posts

Posted

Somehow this does not want to unpack properly yet, does at the same time..

local resppos = getElementData(theVehicle, "respawnposition") 
local x, y, z, rx, ry, rz = unpack(resppos) 

What I mean by this is, if I debug and tell it to output: "outputDebugString(x.." "..y.." "..z)" it outputs all the data.

I even did

if not x or not y or not z or not rx or not ry or not rz then 
outputDebugString("This is the issue here.") 
end 

and nothing was output so I put

else 
outputDebugString("This is somehow the issue.") 
end 

and it output the data there.

And when I look at the debug in game without any other debug I get this

ERROR: bad argument #1 to 'unpack' (table expected, got boolean) 

Posted

If getElementData isn't returning a boolean, that error is impossible based on the code you've posted. As the error message says, unpack is getting a boolean, which means that that's what you got out. It's really hard to say any more without seeing more code.

Posted

Resolved.

Needed to do a work around and pull the data like so:

local respPosT = {0,0,0,0,0,0} 
local respPos = getElementData(theVehicle, "respawnposition") 
if (type(respPos) == "table")) then 
respPosT = respPos 
end 
local x, y, z, rx, ry, rz = unpack(respPosT) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...