Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Core/Debugger/ScriptingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ bool ScriptingContext::LoadScript(string scriptName, string path, string scriptC
}
}

if(lua_isstring(_lua, -1)) {
ProcessLuaError();
}
ProcessLuaError();
return false;
}

void ScriptingContext::ProcessLuaError()
{
string errorMsg = lua_tostring(_lua, -1);
size_t len = 0;
const char* cstr = luaL_tolstring(_lua, -1, &len);
string errorMsg = string(cstr, len);
if(StringUtilities::Contains(errorMsg, "attempt to call a nil value (global 'require')") || StringUtilities::Contains(errorMsg, "attempt to index a nil value (global 'os')") || StringUtilities::Contains(errorMsg, "attempt to index a nil value (global 'io')")) {
Log("I/O and OS libraries are disabled by default for security.\nYou can enable them here:\nScript->Settings->Script Window->Restrictions->Allow access to I/O and OS functions.");
} else if(StringUtilities::Contains(errorMsg, "module 'socket.core' not found")) {
Log("Lua sockets are disabled by default for security.\nYou can enable them here:\nScript->Settings->Script Window->Restrictions->Allow network access.");
} else {
Log(errorMsg);
}
lua_pop(_lua, 1);
lua_pop(_lua, 2);
}

void ScriptingContext::ExecutionCountHook(lua_State* lua)
Expand Down