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

Function open

ogsr_engine/Luabind/src/open.cpp:30–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace luabind {
29
30 void open(lua_State* L)
31 {
32 // get the global class registry, or create one if it doesn't exist
33 // (it's global within a lua state)
34 detail::class_registry* r = 0;
35
36 // If you hit this assert it's because you have called luabind::open()
37 // twice on the same lua_State.
38 assert((detail::class_registry::get_registry(L) == 0)
39 && "you cannot call luabind::open() twice");
40
41 lua_pushstring(L, "__luabind_classes");
42 r = static_cast<detail::class_registry*>(
43 lua_newuserdata(L, sizeof(detail::class_registry)));
44
45 // set gc metatable
46 lua_newtable(L);
47 lua_pushstring(L, "__gc");
48 lua_pushcclosure(
49 L
50 , detail::garbage_collector_s<
51 detail::class_registry
52 >::apply
53 , 0);
54
55 lua_settable(L, -3);
56 lua_setmetatable(L, -2);
57
58 new(r) detail::class_registry(L);
59 lua_settable(L, LUA_REGISTRYINDEX);
60
61 // add functions (class, cast etc...)
62 lua_pushstring(L, "class");
63 lua_pushcclosure(L, detail::create_class::stage1, 0);
64 lua_settable(L, LUA_GLOBALSINDEX);
65 }
66
67} // namespace luabind
68

Callers 9

ReadFileFunction · 0.85
KCoreMethod · 0.85
backtrace_openFunction · 0.85
GetThreadNameFunction · 0.85
lj_prng_seed_secureFunction · 0.85
CInventoryContainerMethod · 0.85
initMethod · 0.85
LS_LoadMethod · 0.85
LS_LoadMethod · 0.85

Calls 6

get_registryFunction · 0.85
lua_pushstringFunction · 0.50
lua_newuserdataFunction · 0.50
lua_pushcclosureFunction · 0.50
lua_settableFunction · 0.50
lua_setmetatableFunction · 0.50

Tested by

no test coverage detected