MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / do_file

Function do_file

ogsr_engine/Layers/xrRender/ResourceManager_Scripting.cpp:316–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316bool do_file(const char* caScriptName, const char* caNameSpaceName)
317{
318 string_path l_caLuaFileName;
319 auto l_tpFileReader = FS.r_open(caScriptName);
320 if (!l_tpFileReader)
321 { //заменить на ассерт?
322 Msg("!![CResourceManager::do_file] Cannot open file [%s]", caScriptName);
323 return false;
324 }
325 strconcat(sizeof(l_caLuaFileName), l_caLuaFileName, "@", caScriptName); // KRodin: приводит путь к виду @f:\games\s.t.a.l.k.e.r\gamedata\scripts\class_registrator.script
326
327 load_buffer(reinterpret_cast<const char*>(l_tpFileReader->pointer()), (size_t)l_tpFileReader->length(), l_caLuaFileName, caNameSpaceName);
328
329 FS.r_close(l_tpFileReader);
330
331 int l_iErrorCode = lua_pcall(LSVM, 0, 0, 0); // KRodin: без этого скрипты не работают!
332 if (l_iErrorCode)
333 {
334 print_output(caScriptName, l_iErrorCode);
335 R_ASSERT(false); //НЕ ЗАКОММЕНТИРОВАТЬ!
336 return false;
337 }
338 return true;
339}
340
341bool namespace_loaded(const char* name, bool remove_from_stack)
342{

Callers 2

LS_LoadMethod · 0.70

Calls 8

MsgFunction · 0.85
r_openMethod · 0.80
pointerMethod · 0.80
r_closeMethod · 0.80
load_bufferFunction · 0.70
print_outputFunction · 0.70
lua_pcallFunction · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected