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

Function RunChunk

Plugins/UnLua/Source/UnLua/Private/UnLuaBase.cpp:128–146  ·  view source on GitHub ↗

* Run a Lua chunk */

Source from the content-addressed store, hash-verified

126 * Run a Lua chunk
127 */
128 bool RunChunk(lua_State *L, const char *Chunk)
129 {
130 if (!Chunk)
131 {
132 UE_LOG(LogUnLua, Warning, TEXT("%s: Invalid lua chunk!"), ANSI_TO_TCHAR(__FUNCTION__));
133 return false;
134 }
135
136 const auto& Env = FLuaEnv::FindEnvChecked(L);
137 const auto DanglingGuard = Env.GetDanglingCheck()->MakeGuard();
138 bool bSuccess = !luaL_dostring(L, Chunk); // loads and runs the given chunk
139 if (!bSuccess)
140 {
141 ReportLuaCallError(L);
142 return false;
143 }
144
145 return bSuccess;
146 }
147
148 /**
149 * Report Lua error

Callers 15

SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
RunTestMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
RunTestMethod · 0.85
SetUpMethod · 0.85

Calls 2

ReportLuaCallErrorFunction · 0.85
MakeGuardMethod · 0.45

Tested by 15

SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
RunTestMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
RunTestMethod · 0.68
SetUpMethod · 0.68