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) 

All kinds of feedback are welcome on all of my posts.

Posted

getElementData is returning false.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
getElementData is returning false.

Not sure if you fully understood me but I did a outputDebugString and it returned the table

  
outputDebugString(x.." "..y.." "..z.." "..rx.." "..ry.." "..rz) 
  

All kinds of feedback are welcome on all of my posts.

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.

Do NOT PM ME for help unless invited. - New MTA Script Editor

Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.

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) 

All kinds of feedback are welcome on all of my 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 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...