summaryrefslogtreecommitdiff
path: root/src/cat/LegacyLuaAPI.cpp
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2013-05-04 00:11:52 (GMT)
committer mniip <mniip@mniip.com>2013-05-04 00:11:52 (GMT)
commit88cbb81ec44ae0688d7e0b570e906b23b50d3c9e (patch)
tree64bd6d5bd89378b41e04cd35855d16347a78601d /src/cat/LegacyLuaAPI.cpp
parent4cd12e8561b71ce32598d791ddedf5f1aef9203c (diff)
downloadpowder-88cbb81ec44ae0688d7e0b570e906b23b50d3c9e.zip
powder-88cbb81ec44ae0688d7e0b570e906b23b50d3c9e.tar.gz
fix crash on non-string error in step and other functions
Diffstat (limited to 'src/cat/LegacyLuaAPI.cpp')
-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