Skip to content

Commit 6fbafe2

Browse files
author
minggo
authored
Merge pull request #179 from xpol/v3
Add ability to get class name form a tolua c++ class.
2 parents 432bf9e + c17202e commit 6fbafe2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lua/tolua/tolua_map.c

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ static int tolua_newmetatable (lua_State* L, const char* name)
3939

4040
if (r)
4141
tolua_classevents(L); /* set meta events */
42+
43+
// metatable[".classname"] = name
44+
lua_pushliteral(L, ".classname"); // stack: metatable ".classname"
45+
lua_pushstring(L, name); // stack: metatable ".classname" name
46+
lua_rawset(L, -3); // stack: metatable
47+
4248
lua_pop(L,1);
4349
return r;
4450
}

0 commit comments

Comments
 (0)