diff options
-rw-r--r-- | src/scripting/lua.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 7cc09d56..546f4a66 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -299,7 +299,7 @@ static int chr_warp(lua_State *s) Character *q = getCharacter(s, 1); bool b = lua_isnil(s, 2); - if (!q || !(b || lua_isnumber(s, 2))) + if (!q || !(b || lua_isnumber(s, 2) || lua_isstring(s, 2))) { raiseScriptError(s, "chr_warp called with incorrect parameters."); return 0; @@ -312,10 +312,14 @@ static int chr_warp(lua_State *s) Script *t = static_cast<Script *>(lua_touserdata(s, -1)); m = t->getMap(); } - else + else if (lua_isnumber(s, 2)) { m = MapManager::getMap(lua_tointeger(s, 2)); } + else + { + m = MapManager::getMap(lua_tostring(s, 2)); + } if (!m) { raiseScriptError(s, "chr_warp called with a non-existing map."); |