Reputation: 85
im wondering if there is way to get class name of object at runtime. i mean something like this: here is my very simple script
person=TPerson:new()
And i want in my app (in delphi) get "TPerson" I tried it with lua debug info but what i know to get is called function "new" but i need to get class "TPerson"
lua_getstack(l,0,PL_Debug);
lua_getfield(l,LUA_GLOBALSINDEX,'f');
lua_getinfo(l,'n',PL_Debug);
nameOfCurrnetFunction:=PL_Debug.name; // here is stored "new"
so is possible to get class name? thanks
Upvotes: 1
Views: 5062
Reputation: 28954
Officially you do not have classes in Lua so the type of your objects would always be table. Of course you are free to implement some function that returns you a custom type-name as a string. Lua-wise it will remain a table tough
Upvotes: 5