summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-05-04 00:13:56 (GMT)
committer jacob1 <jfu614@gmail.com>2013-05-04 00:13:56 (GMT)
commit773d500d8abeb5b5c0a957a947cd5b66441ddfa8 (patch)
tree1791de64623b1a8d3ca3be97fc87b69dd089b1f2 /src
parent3018c597c4cc2e58751d52020f5c927a3329a56f (diff)
parent88cbb81ec44ae0688d7e0b570e906b23b50d3c9e (diff)
downloadpowder-773d500d8abeb5b5c0a957a947cd5b66441ddfa8.zip
powder-773d500d8abeb5b5c0a957a947cd5b66441ddfa8.tar.gz
mniip: fix crash on non-string error in step and other functions
Diffstat (limited to 'src')
-rw-r--r--src/cat/LegacyLuaAPI.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp
index 2166b14..4d3c0c8 100644
--- a/src/cat/LegacyLuaAPI.cpp
+++ b/src/cat/LegacyLuaAPI.cpp
@@ -514,7 +514,7 @@ int luacon_keyevent(int key, int modifier, int event)
callret = lua_pcall(l, 4, 1, 0);
if (callret)
{
- if (!strcmp(luaL_optstring(l, -1, ""), "Error: Script not responding"))
+ if (!strcmp(luacon_geterror(), "Error: Script not responding"))
{
ui::Engine::Ref().LastTick(clock());
for(j=i;j<=c-1;j++)
@@ -566,7 +566,7 @@ int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel)
callret = lua_pcall(l, 5, 1, 0);
if (callret)
{
- if (!strcmp(luaL_optstring(l, -1, ""), "Error: Script not responding"))
+ if (!strcmp(luacon_geterror(), "Error: Script not responding"))
{
ui::Engine::Ref().LastTick(clock());
for(j=i;j<=c-1;j++)
@@ -579,7 +579,7 @@ int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel)
c--;
i--;
}
- luacon_ci->Log(CommandInterface::LogError, luaL_optstring(l, -1, ""));
+ luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
lua_pop(l, 1);
}
else
@@ -627,7 +627,7 @@ int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::s
callret = lua_pcall(l, 0, 0, 0);
if (callret)
{
- if (!strcmp(luaL_optstring(l, -1, ""), "Error: Script not responding"))
+ if (!strcmp(luacon_geterror(), "Error: Script not responding"))
{
ui::Engine::Ref().LastTick(clock());
for(j=i;j<=c-1;j++)
@@ -640,7 +640,7 @@ int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::s
c--;
i--;
}
- luacon_ci->Log(CommandInterface::LogError, luaL_optstring(l, -1, ""));
+ luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
lua_pop(l, 1);
}
}
@@ -796,7 +796,7 @@ int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS, int i)
callret = lua_pcall(luacon_ci->l, 4, 10, 0);
if (callret)
{
- luacon_ci->Log(CommandInterface::LogError, luaL_optstring(luacon_ci->l, -1, ""));
+ luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
lua_pop(luacon_ci->l, 1);
}
else