aboutsummaryrefslogtreecommitdiff
path: root/src/auxiliar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auxiliar.c')
-rw-r--r--src/auxiliar.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/auxiliar.c b/src/auxiliar.c
index 3396fc1..c4e5260 100644
--- a/src/auxiliar.c
+++ b/src/auxiliar.c
@@ -8,7 +8,6 @@
8#include <stdio.h> 8#include <stdio.h>
9 9
10#include "auxiliar.h" 10#include "auxiliar.h"
11#include "lua_typeerror.h"
12 11
13/*=========================================================================*\ 12/*=========================================================================*\
14* Exported functions 13* Exported functions
@@ -82,7 +81,7 @@ void auxiliar_add2group(lua_State *L, const char *classname, const char *groupna
82\*-------------------------------------------------------------------------*/ 81\*-------------------------------------------------------------------------*/
83int auxiliar_checkboolean(lua_State *L, int objidx) { 82int auxiliar_checkboolean(lua_State *L, int objidx) {
84 if (!lua_isboolean(L, objidx)) 83 if (!lua_isboolean(L, objidx))
85 luaL_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN)); 84 auxiliar_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN));
86 return lua_toboolean(L, objidx); 85 return lua_toboolean(L, objidx);
87} 86}
88 87
@@ -148,3 +147,14 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) {
148void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) { 147void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) {
149 return luaL_checkudata(L, objidx, classname); 148 return luaL_checkudata(L, objidx, classname);
150} 149}
150
151/*-------------------------------------------------------------------------*\
152* Throws error when argument does not have correct type.
153* Used to be part of lauxlib in Lua 5.1, was dropped from 5.2.
154\*-------------------------------------------------------------------------*/
155int auxiliar_typeerror (lua_State *L, int narg, const char *tname) {
156 const char *msg = lua_pushfstring(L, "%s expected, got %s", tname,
157 luaL_typename(L, narg));
158 return luaL_argerror(L, narg, msg);
159}
160