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

Method register_methods

ogsr_engine/Luabind/src/class_rep.cpp:1462–1492  ·  view source on GitHub ↗

this function will add all the overloads in method rep to this class' lua tables. If there already are overloads with this name, thses will simply be appended to the overload list

Source from the content-addressed store, hash-verified

1460// this class' lua tables. If there already are overloads with this
1461// name, thses will simply be appended to the overload list
1462void luabind::detail::class_rep::register_methods(lua_State* L)
1463{
1464 LUABIND_CHECK_STACK(L);
1465 // insert the function in the normal member table
1466 // and in the default member table
1467 m_default_table_ref.get(L);
1468 m_table_ref.get(L);
1469
1470 // pops the tables
1471 detail::stack_pop pop_tables(L, 2);
1472
1473 for (list_class<method_rep>::const_iterator m = m_methods.begin();
1474 m != m_methods.end(); ++m)
1475 {
1476 // create the function closure in m_table_ref
1477 lua_pushstring(L, m->name);
1478 lua_pushlightuserdata(L, const_cast<void*>((const void*)&(*m)));
1479 lua_pushboolean(L, 0);
1480 lua_pushlightuserdata(L, reinterpret_cast<void*>(0x1337));
1481 lua_pushcclosure(L, function_dispatcher, 3);
1482 lua_settable(L, -3);
1483
1484 // create the function closure in m_default_table_ref
1485 lua_pushstring(L, m->name);
1486 lua_pushlightuserdata(L, const_cast<void*>((const void*)&(*m)));
1487 lua_pushboolean(L, 1);
1488 lua_pushlightuserdata(L, reinterpret_cast<void*>(0x1337));
1489 lua_pushcclosure(L, function_dispatcher, 3);
1490 lua_settable(L, -4);
1491 }
1492}
1493
1494const class_rep::property_map& luabind::detail::class_rep::properties() const
1495{

Callers 1

register_Method · 0.80

Calls 8

lua_pushlightuserdataFunction · 0.85
lua_pushstringFunction · 0.50
lua_pushbooleanFunction · 0.50
lua_pushcclosureFunction · 0.50
lua_settableFunction · 0.50
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected