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

Method static_class_gettable

ogsr_engine/Luabind/src/class_rep.cpp:1237–1281  ·  view source on GitHub ↗

stack: 1: class_rep 2: member name */

Source from the content-addressed store, hash-verified

1235 2: member name
1236*/
1237int luabind::detail::class_rep::static_class_gettable(lua_State* L)
1238{
1239 class_rep* crep = static_cast<class_rep*>(lua_touserdata(L, 1));
1240
1241 // look in the static function table
1242 crep->get_default_table(L);
1243 lua_pushvalue(L, 2);
1244 lua_gettable(L, -2);
1245 if (!lua_isnil(L, -1)) return 1;
1246 else lua_pop(L, 2);
1247
1248 const char* key = lua_tostring(L, 2);
1249
1250 if (std::strlen(key) != lua_strlen(L, 2))
1251 {
1252 lua_pushnil(L);
1253 return 1;
1254 }
1255
1256 map_class<const char*, int, ltstr>::const_iterator j = crep->m_static_constants.find(key);
1257
1258 if (j != crep->m_static_constants.end())
1259 {
1260 lua_pushnumber(L, j->second);
1261 return 1;
1262 }
1263
1264#ifndef LUABIND_NO_ERROR_CHECKING
1265
1266 {
1267 string_class msg = "no static '";
1268 msg += key;
1269 msg += "' in class '";
1270 msg += crep->name();
1271 msg += "'";
1272 lua_pushstring(L, msg.c_str());
1273 }
1274 lua_error(L);
1275
1276#endif
1277
1278 lua_pushnil(L);
1279
1280 return 1;
1281}
1282
1283bool luabind::detail::is_class_rep(lua_State* L, int index)
1284{

Callers

nothing calls this directly

Calls 11

lua_touserdataFunction · 0.50
lua_pushvalueFunction · 0.50
lua_gettableFunction · 0.50
lua_pushnilFunction · 0.50
lua_pushnumberFunction · 0.50
lua_pushstringFunction · 0.50
lua_errorFunction · 0.50
findMethod · 0.45
endMethod · 0.45
nameMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected