summaryrefslogtreecommitdiff
path: root/src/cat
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-08-09 02:45:08 (GMT)
committer jacob1 <jfu614@gmail.com>2013-08-09 02:45:08 (GMT)
commitab6a0c20722a98c275937d2dcd04e918cece5a4c (patch)
tree4e94b4d0251d8687eff32b4549ca0c8f57e6ac9e /src/cat
parent73544bd06918393ceddfaaeb3a7efd08bdac0c81 (diff)
downloadpowder-ab6a0c20722a98c275937d2dcd04e918cece5a4c.zip
powder-ab6a0c20722a98c275937d2dcd04e918cece5a4c.tar.gz
Fix tpt.element(<something not a string or number>) returning 1
Diffstat (limited to 'src/cat')
-rw-r--r--src/cat/LegacyLuaAPI.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp
index 2b7125a..293d45e 100644
--- a/src/cat/LegacyLuaAPI.cpp
+++ b/src/cat/LegacyLuaAPI.cpp
@@ -713,7 +713,8 @@ int luatpt_getelement(lua_State *l)
}
else
{
- char* name = (char*)luaL_optstring(l, 1, "dust");
+ luaL_checktype(l, 1, LUA_TSTRING);
+ char* name = (char*)luaL_optstring(l, 1, "");
if ((t = luacon_ci->GetParticleType(name))==-1)
return luaL_error(l, "Unrecognised element '%s'", name);
lua_pushinteger(l, t);