🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Getting the callers name within the Lua glue.
From within the glue function of a Lua usertype, is it possible to obtain a string name of the variable that the glue function instantiates. Let my clarify a bit.
-- lua code starts here
MyLuaObject = MyCppClass:new()
// C++ glue code here
map<string, MyCppClass> ObjectMap;
tolua_MyCppClass_new()
{
//...
//... obtain the variable name, "MyLuaObject" in this case
string variableName = ???
ObjectMap.insert(pair<string, MyCppClass>(variableName, MyCppClass());
void* userdata = &ObjectMap[variableName];
//... return it to Lua
}
In this way the internal program could access "special" variable from Lua. (Variables that it expects to be there).
[edited by - MindCode on September 28, 2003 12:31:17 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement