| 412 | } |
| 413 | |
| 414 | void FLuaEnv::ResumeThread(int32 ThreadRef) |
| 415 | { |
| 416 | lua_State** ThreadPtr = RefToThread.Find(ThreadRef); |
| 417 | if (!ThreadPtr) |
| 418 | return; |
| 419 | |
| 420 | lua_State* Thread = *ThreadPtr; |
| 421 | #if 504 == LUA_VERSION_NUM |
| 422 | int NResults = 0; |
| 423 | int32 Status = lua_resume(Thread, L, 0, &NResults); |
| 424 | #else |
| 425 | int32 Status = lua_resume(Thread, L, 0); |
| 426 | #endif |
| 427 | if (Status == LUA_YIELD) |
| 428 | return; |
| 429 | |
| 430 | if (Status != LUA_OK) |
| 431 | { |
| 432 | const auto ErrMsg = lua_tostring(Thread, -1); |
| 433 | UE_LOG(LogUnLua, Error, TEXT("%s"), UTF8_TO_TCHAR(ErrMsg)); |
| 434 | } |
| 435 | |
| 436 | ThreadToRef.Remove(Thread); |
| 437 | RefToThread.Remove(ThreadRef); |
| 438 | luaL_unref(L, LUA_REGISTRYINDEX, ThreadRef); // remove the reference if the coroutine finishes its execution |
| 439 | } |
| 440 | |
| 441 | UUnLuaManager* FLuaEnv::GetManager() |
| 442 | { |
no test coverage detected