* Generic closure to call a latent function */
| 1521 | * Generic closure to call a latent function |
| 1522 | */ |
| 1523 | int32 Class_CallLatentFunction(lua_State *L) |
| 1524 | { |
| 1525 | auto& Env = UnLua::FLuaEnv::FindEnvChecked(L); |
| 1526 | auto Function = Env.GetObjectRegistry()->Get<FFunctionDesc>(L, lua_upvalueindex(1)); |
| 1527 | if (!Function->IsValid()) |
| 1528 | { |
| 1529 | UE_LOG(LogUnLua, Log, TEXT("%s: Invalid function descriptor!"), ANSI_TO_TCHAR(__FUNCTION__)); |
| 1530 | return 0; |
| 1531 | } |
| 1532 | |
| 1533 | auto ThreadRef = Env.FindOrAddThread(L); |
| 1534 | if (ThreadRef == LUA_REFNIL) |
| 1535 | { |
| 1536 | UNLUA_LOGERROR(L, LogUnLua, Warning, TEXT("%s: Can't call latent action in main lua thread!"), ANSI_TO_TCHAR(__FUNCTION__)); |
| 1537 | return 0; |
| 1538 | } |
| 1539 | |
| 1540 | int32 NumParams = lua_gettop(L); |
| 1541 | int32 NumResults = Function->CallUE(L, NumParams, &ThreadRef); |
| 1542 | return lua_yield(L, NumResults); |
| 1543 | } |
| 1544 | |
| 1545 | FClassDesc* Class_CheckParam(lua_State *L) |
| 1546 | { |
nothing calls this directly
no test coverage detected