void LuaInterface::loadScript(const std::string& fileName) { // resolve file full path std::string filePath = fileName; if(!stdext::starts_with(fileName, "/")) filePath = getCurrentSourcePath() + "/" + filePath; filePath = g_resources.guessFilePath(filePath, "lua"); std::string buffer = g_resources.readFileContents(filePath); std::string source = "@" + filePath; loadBuffer(buffer, source); }
void LuaInterface::loadScript(const std::string& fileName) { // resolve file full path std::string filePath = fileName; if(!boost::starts_with(fileName, "/")) filePath = getCurrentSourcePath() + "/" + filePath; try { std::string buffer = g_resources.loadFile(filePath); std::string source = "@" + filePath; loadBuffer(buffer, source); } catch(Exception& e) { throw LuaException(e.what()); } }