From 61ac3cbf1e507f103e5fc240958971f512cd8c73 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 17 Mar 2012 20:20:10 +0100 Subject: Made skill related function capable of taking the skill name as parameter Reviewed-by: bjorn. --- src/scripting/luautil.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/scripting/luautil.cpp') diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp index 8bc72d3..67dd739 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 */) { -- cgit