diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-17 20:20:10 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-17 23:40:30 +0100 |
commit | 61ac3cbf1e507f103e5fc240958971f512cd8c73 (patch) | |
tree | 28fc78e2047a91f9b6131d2f3e62d83c4db23711 /src/scripting/luautil.cpp | |
parent | a6c3eed2b9a91e9768ec6ce137879cac13703dea (diff) | |
download | manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.tar.gz manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.tar.bz2 manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.tar.xz manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.zip |
Made skill related function capable of taking the skill name as parameter
Reviewed-by: bjorn.
Diffstat (limited to 'src/scripting/luautil.cpp')
-rw-r--r-- | src/scripting/luautil.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp index 8bc72d3f..67dd7395 100644 --- a/src/scripting/luautil.cpp +++ b/src/scripting/luautil.cpp @@ -26,6 +26,7 @@ #include "game-server/monster.h" #include "game-server/monstermanager.h" #include "game-server/npc.h" +#include "game-server/skillmanager.h" #include "utils/logger.h" @@ -252,6 +253,17 @@ NPC *checkNPC(lua_State *s, int p) return npc; } +int checkSkill(lua_State *s, int p) +{ + if (lua_isstring(s, p)) + { + int id = skillManager->getId(luaL_checkstring(s, p)); + luaL_argcheck(s, id != 0, p, "invalid skill name"); + return id; + } + return luaL_checkint(s, 2); +} + MapComposite *checkCurrentMap(lua_State *s, Script *script /* = 0 */) { |