Lua Userdata
In my application I have a script that has a function that calls an object factory and tells it to create objects. Only problem is once the object is created I am having trouble returning it to the script, heres the function
DataType* To_Create = new DataType;
lua_pushlightuserdata(gScript,(void*)To_Create);
lua_setglobal(gScript, "Generic_Data");
Later I pass this data via script into another c++ function where Add_Data represents a c++ function that takes a void pointer and converts it to the appropriate data.
Add_Data(Generic_Data)
All of this seems right to me but its not working. Generic data s making it from one side to the other. Anyone who has an experience with this I would appreciate the input. Thanks for your time
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement