MCPcopy Create free account
hub / github.com/Tencent/UnLua / ScriptStruct_Index

Function ScriptStruct_Index

Plugins/UnLua/Source/UnLua/Private/LuaCore.cpp:1613–1631  ·  view source on GitHub ↗

* __index meta methods for struct */

Source from the content-addressed store, hash-verified

1611 * __index meta methods for struct
1612 */
1613int32 ScriptStruct_Index(lua_State *L)
1614{
1615 GetField(L);
1616 if (lua_type(L, -1) != LUA_TUSERDATA)
1617 return 1;
1618
1619 const auto Registry = UnLua::FLuaEnv::FindEnvChecked(L).GetObjectRegistry();
1620 const auto Property = Registry->Get<UnLua::ITypeOps>(L, -1).Get();
1621 if (!Property || !Property->IsValid())
1622 return 0;
1623
1624 const auto Self = GetCppInstanceFast(L, 1);
1625 if (!Self)
1626 return luaL_error(L, TCHAR_TO_UTF8(*FString::Printf(TEXT("attempt to read property '%s' on released struct"), *Property->GetName())));
1627
1628 Property->Read(L, Self, false);
1629 lua_remove(L, -2);
1630 return 1;
1631}
1632
1633FClassDesc* ScriptStruct_CheckParam(lua_State *L)
1634{

Callers

nothing calls this directly

Calls 8

GetFieldFunction · 0.85
lua_typeFunction · 0.85
GetCppInstanceFastFunction · 0.85
luaL_errorFunction · 0.85
GetMethod · 0.45
IsValidMethod · 0.45
GetNameMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected