stack: 1: class_rep 2: member name */
| 1235 | 2: member name |
| 1236 | */ |
| 1237 | int 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 | |
| 1283 | bool luabind::detail::is_class_rep(lua_State* L, int index) |
| 1284 | { |
nothing calls this directly
no test coverage detected