MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / create_cpp_class_metatable

Function create_cpp_class_metatable

ogsr_engine/Luabind/src/class_registry.cpp:43–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 }
42
43 int create_cpp_class_metatable(lua_State* L)
44 {
45 lua_newtable(L);
46
47 // mark the table with our (hopefully) unique tag
48 // that says that the user data that has this
49 // metatable is a class_rep
50 lua_pushstring(L, "__luabind_classrep");
51 lua_pushboolean(L, 1);
52 lua_rawset(L, -3);
53
54 lua_pushstring(L, "__gc");
55 lua_pushcclosure(
56 L
57 , &garbage_collector_s<
58 detail::class_rep
59 >::apply
60 , 0);
61
62 lua_rawset(L, -3);
63
64 lua_pushstring(L, "__call");
65 lua_pushcclosure(L, &class_rep::constructor_dispatcher, 0);
66 lua_rawset(L, -3);
67
68 lua_pushstring(L, "__index");
69 lua_pushcclosure(L, &class_rep::static_class_gettable, 0);
70 lua_rawset(L, -3);
71
72 lua_pushstring(L, "__newindex");
73 lua_pushcclosure(L, &class_rep::lua_settable_dispatcher, 0);
74 lua_rawset(L, -3);
75
76 return detail::ref(L);
77 }
78
79 int create_cpp_instance_metatable(lua_State* L)
80 {

Callers 1

class_registryMethod · 0.85

Calls 4

lua_pushstringFunction · 0.50
lua_pushbooleanFunction · 0.50
lua_rawsetFunction · 0.50
lua_pushcclosureFunction · 0.50

Tested by

no test coverage detected