Frozia Posted July 5, 2013 Share Posted July 5, 2013 Hey everyone, I'm trying to do something.But I have some errors.I cant store a class with setElementData. local objects = getElementData(scene,"objects") table.insert(objects,object); setElementData(scene,"objects",objects) outputDebugString(tostring(objects[1]:PositionX(5))) -- it works objects = getElementData(scene,"objects") outputDebugString(tostring(objects[1]:PositionX(5))) -- but it doesnt work. What is the problem ? Element is correct. I know it because I'm using it in clientRender. Link to comment
codeluaeveryday Posted July 5, 2013 Share Posted July 5, 2013 'object' is not defined. Link to comment
Frozia Posted July 5, 2013 Author Share Posted July 5, 2013 'object' is not defined. Oh no, It's defined and works excellent. There is just a problem with set/getElementData Link to comment
MIKI785 Posted July 5, 2013 Share Posted July 5, 2013 The debug doesn't output anything? Link to comment
Frozia Posted July 5, 2013 Author Share Posted July 5, 2013 The debug doesn't output anything? local objects = getElementData(scene,"objects") table.insert(objects,object); setElementData(scene,"objects",objects) outputDebugString(tostring(objects[1]:PositionX(5))) -- Outputs: 5 (as I want) objects = getElementData(scene,"objects") outputDebugString(tostring(objects[1]:PositionX(5))) -- Outputs: 'PositionX' is nil Link to comment
MIKI785 Posted July 5, 2013 Share Posted July 5, 2013 Read this: https://wiki.multitheftauto.com/wiki/Element_Data Maybe you're saving something that cannot be saved into element data. Link to comment
Frozia Posted July 5, 2013 Author Share Posted July 5, 2013 Read this: https://wiki.multitheftauto.com/wiki/Element_DataMaybe you're saving something that cannot be saved into element data. I dont think so because I can use the variables like objects[1].posX, Just I cant use the functions and I need use it. Oh I solved the problem.I use "setmetatable(object, Texture2D_class);" after getElementData. Thanks for all. Link to comment
Recommended 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 accountSign in
Already have an account? Sign in here.
Sign In Now