* __index meta methods for class */
| 1430 | * __index meta methods for class |
| 1431 | */ |
| 1432 | int32 Class_Index(lua_State *L) |
| 1433 | { |
| 1434 | GetField(L); |
| 1435 | |
| 1436 | const auto Ptr = lua_touserdata(L, -1); |
| 1437 | if (!Ptr) |
| 1438 | return 1; |
| 1439 | |
| 1440 | const auto Property = static_cast<TSharedPtr<UnLua::ITypeOps>*>(Ptr)->Get(); |
| 1441 | if (!Property || !Property->IsValid()) |
| 1442 | return 0; |
| 1443 | |
| 1444 | const auto Self = GetCppInstance(L, 1); |
| 1445 | if (!Self) |
| 1446 | return 1; |
| 1447 | |
| 1448 | if (UnLua::LowLevel::IsReleasedPtr(Self)) |
| 1449 | return luaL_error(L, TCHAR_TO_UTF8(*FString::Printf(TEXT("attempt to read property '%s' on released object"), *Property->GetName()))); |
| 1450 | |
| 1451 | if (!UnLua::LowLevel::CheckPropertyOwner(L, Property, Self)) |
| 1452 | return 0; |
| 1453 | |
| 1454 | Property->Read(L, Self, false); |
| 1455 | lua_remove(L, -2); |
| 1456 | return 1; |
| 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * __newindex meta methods for class |
nothing calls this directly
no test coverage detected