MCPcopy Create free account
hub / github.com/axmolengine/axmol / executeScriptFile

Method executeScriptFile

extensions/scripting/lua-bindings/manual/LuaStack.cpp:311–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311int LuaStack::executeScriptFile(const char* filename)
312{
313 AXASSERT(filename, "CCLuaStack::executeScriptFile() - invalid filename");
314
315 std::string filePath{filename};
316 Data data = FileUtils::getInstance()->getDataFromFile(filePath);
317 int rn = 0;
318 if (!data.isNull())
319 {
320 filePath.insert(filePath.begin(), '@'); // lua standard, add file chunck mark '@'
321 if (luaLoadBuffer(_state, (const char*)data.getBytes(), (int)data.getSize(), filePath.c_str()) == 0)
322 {
323 rn = executeFunction(0);
324 }
325 }
326 return rn;
327}
328
329int LuaStack::executeGlobalFunction(const char* functionName)
330{

Callers 1

Calls 8

getInstanceFunction · 0.85
getDataFromFileMethod · 0.80
isNullMethod · 0.80
getBytesMethod · 0.80
insertMethod · 0.45
beginMethod · 0.45
getSizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected