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

Method DoString

Plugins/UnLua/Source/UnLua/Private/LuaEnv.cpp:341–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339 }
340
341 bool FLuaEnv::DoString(const FString& Chunk, const FString& ChunkName)
342 {
343 const FTCHARToUTF8 ChunkUTF8(*Chunk);
344 const FTCHARToUTF8 ChunkNameUTF8(*ChunkName);
345 const auto Guard = GetDeadLoopCheck()->MakeGuard();
346 const auto DanglingGuard = GetDanglingCheck()->MakeGuard();
347 lua_pushcfunction(L, ReportLuaCallError);
348 const auto MsgHandlerIdx = lua_gettop(L);
349 if (!LoadBuffer(ChunkUTF8.Get(), ChunkUTF8.Length(), ChunkNameUTF8.Get()))
350 {
351 lua_pop(L, 1);
352 return false;
353 }
354
355 const auto Result = lua_pcall(L, 0, LUA_MULTRET, MsgHandlerIdx);
356 if (Result == LUA_OK)
357 {
358 lua_remove(L, MsgHandlerIdx);
359 return true;
360 }
361 lua_pop(L, lua_gettop(L) - MsgHandlerIdx + 1);
362 return false;
363 }
364
365 bool FLuaEnv::LoadBuffer(const char* Buffer, const size_t Size, const char* InName)
366 {

Callers 12

CallLuaByGlobalTableMethod · 0.80
OnLuaEnvCreatedMethod · 0.80
OnLuaEnvCreatedMethod · 0.80
DoMethod · 0.80
DoFileMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80
DefineMethod · 0.80

Calls 6

GetDeadLoopCheckFunction · 0.85
GetDanglingCheckFunction · 0.85
lua_gettopFunction · 0.85
MakeGuardMethod · 0.45
GetMethod · 0.45
LengthMethod · 0.45

Tested by 7

DefineMethod · 0.64
DefineMethod · 0.64
DefineMethod · 0.64
DefineMethod · 0.64
DefineMethod · 0.64
DefineMethod · 0.64
DefineMethod · 0.64