summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-14 23:26:02 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-14 23:26:02 -0600
commitce2fc28dc790b02c7a9beb99ca39204aa78906ab (patch)
tree7f5390ccbf5446fbc550ad9c9255092b181b2ff8 /src
parent6bdbbe247566728390ad7fee19ea233405433651 (diff)
downloadmanaserv-ce2fc28dc790b02c7a9beb99ca39204aa78906ab.tar.gz
manaserv-ce2fc28dc790b02c7a9beb99ca39204aa78906ab.tar.bz2
manaserv-ce2fc28dc790b02c7a9beb99ca39204aa78906ab.tar.xz
manaserv-ce2fc28dc790b02c7a9beb99ca39204aa78906ab.zip
lua_tofloat doesn't exist in Lua 5.1
Also make that parameter optional
Diffstat (limited to 'src')
-rw-r--r--src/scripting/lua.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index ae02eabf..b17bc90f 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -590,7 +590,7 @@ static int being_type(lua_State *s)
*/
static int being_walk(lua_State *s)
{
- if (!lua_isnumber(s, 2) || !lua_isnumber(s, 3) || !lua_isnumber(s, 4))
+ if (!lua_isnumber(s, 2) || !lua_isnumber(s, 3))
{
raiseScriptError(s, "being_walk called with incorrect parameters.");
return 0;
@@ -598,11 +598,12 @@ static int being_walk(lua_State *s)
lua_pushlightuserdata(s, (void *)&registryKey);
lua_gettable(s, LUA_REGISTRYINDEX);
-
Being *being = getBeing(s, 1);
Point destination(lua_tointeger(s, 2), lua_tointeger(s, 3));
being->setDestination(destination);
- being->setSpeed(lua_tofloat(s, 4));
+
+ if (lua_isnumber(s, 4))
+ being->setSpeed((float) lua_tonumber(s, 4));
return 0;
}