Skip to content

Commit ee3a18e

Browse files
Merge pull request gameplay3d#922 from dgough/next
Changed ScriptController::loadScript() to use dofile instead of dostring
2 parents ab18887 + 19a1961 commit ee3a18e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gameplay/src/ScriptController.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,15 @@ void ScriptController::loadScript(const char* path, bool forceReload)
429429
std::set<std::string>::iterator iter = _loadedScripts.find(path);
430430
if (iter == _loadedScripts.end() || forceReload)
431431
{
432+
#ifdef __ANDROID__
432433
const char* scriptContents = FileSystem::readAll(path);
433434
if (luaL_dostring(_lua, scriptContents))
434435
GP_WARN("Failed to run Lua script with error: '%s'.", lua_tostring(_lua, -1));
435-
436436
SAFE_DELETE_ARRAY(scriptContents);
437-
437+
#else
438+
if (luaL_dofile(_lua, path))
439+
GP_WARN("Failed to run Lua script with error: '%s'.", lua_tostring(_lua, -1));
440+
#endif
438441
if (iter == _loadedScripts.end())
439442
_loadedScripts.insert(path);
440443
}

0 commit comments

Comments
 (0)