| 309 | } |
| 310 | |
| 311 | int 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 | |
| 329 | int LuaStack::executeGlobalFunction(const char* functionName) |
| 330 | { |
no test coverage detected