From ab6a0c20722a98c275937d2dcd04e918cece5a4c Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 8 Aug 2013 22:45:08 -0400 Subject: [PATCH] Fix tpt.element() returning 1 --- src/cat/LegacyLuaAPI.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp index 2b7125a86..293d45ef9 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);