* __index meta methods for enum */
| 1287 | * __index meta methods for enum |
| 1288 | */ |
| 1289 | int32 Enum_Index(lua_State *L) |
| 1290 | { |
| 1291 | // 1: meta table of the Enum; 2: entry name in Enum |
| 1292 | |
| 1293 | check(lua_isstring(L, -1)); |
| 1294 | lua_pushstring(L, "__name"); // 3 |
| 1295 | lua_rawget(L, 1); // 3 |
| 1296 | check(lua_isstring(L, -1)); |
| 1297 | |
| 1298 | const FEnumDesc* Enum = UnLua::FLuaEnv::FindEnvChecked(L).GetEnumRegistry()->Find(lua_tostring(L, -1)); |
| 1299 | if ((!Enum) |
| 1300 | || (!Enum->IsValid())) |
| 1301 | { |
| 1302 | lua_pop(L, 1); |
| 1303 | return 0; |
| 1304 | } |
| 1305 | int64 Value = Enum->GetValue(lua_tostring(L, 2)); |
| 1306 | |
| 1307 | lua_pop(L, 1); |
| 1308 | lua_pushvalue(L, 2); |
| 1309 | lua_pushinteger(L, Value); |
| 1310 | lua_rawset(L, 1); |
| 1311 | lua_pushinteger(L, Value); |
| 1312 | |
| 1313 | return 1; |
| 1314 | } |
| 1315 | |
| 1316 | int32 Enum_Delete(lua_State *L) |
| 1317 | { |
nothing calls this directly
no test coverage detected