diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-04 15:44:47 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-05 19:47:54 +0100 |
commit | 9f67ba0e68d0a85944268c55045c28d6d12983b5 (patch) | |
tree | b3c9be621f83829acabd766a67862d861e53218d /src/scripting/luautil.h | |
parent | aed3f8be2d96dce957de6884944ea666aadc5bd2 (diff) | |
download | manaserv-9f67ba0e68d0a85944268c55045c28d6d12983b5.tar.gz manaserv-9f67ba0e68d0a85944268c55045c28d6d12983b5.tar.bz2 manaserv-9f67ba0e68d0a85944268c55045c28d6d12983b5.tar.xz manaserv-9f67ba0e68d0a85944268c55045c28d6d12983b5.zip |
Improved Lua API argument checking
It's a bit embarrassing the way this has gotten out of hand. The error
checking was inconsistent, and in some cases wrong.
A host of new helper functions, starting with 'check' rather than 'get',
perform error handling on function arguments (they will not return when
encountering an error).
Reviewed-by: Erik Schilling
Diffstat (limited to 'src/scripting/luautil.h')
-rw-r--r-- | src/scripting/luautil.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index 3286bded..78930a66 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -157,8 +157,12 @@ Monster * getMonster(lua_State *s, int p); MonsterClass * getMonsterClass(lua_State *s, int p); NPC * getNPC(lua_State *s, int p); +Being * checkBeing(lua_State *s, int p); +Character * checkCharacter(lua_State *s, int p); ItemClass * checkItemClass(lua_State *s, int p); +Monster * checkMonster(lua_State *s, int p); MonsterClass * checkMonsterClass(lua_State *s, int p); +NPC * checkNPC(lua_State *s, int p); /* Polymorphic wrapper for pushing variables. |