mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-16 22:09:48 +02:00
merged lua_typerrror.{c,h} into auxiliar.{c,h}
This commit is contained in:
@ -8,7 +8,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "lua_typeerror.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
@ -82,7 +81,7 @@ void auxiliar_add2group(lua_State *L, const char *classname, const char *groupna
|
||||
\*-------------------------------------------------------------------------*/
|
||||
int auxiliar_checkboolean(lua_State *L, int objidx) {
|
||||
if (!lua_isboolean(L, objidx))
|
||||
luaL_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN));
|
||||
auxiliar_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN));
|
||||
return lua_toboolean(L, objidx);
|
||||
}
|
||||
|
||||
@ -148,3 +147,14 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) {
|
||||
void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) {
|
||||
return luaL_checkudata(L, objidx, classname);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Throws error when argument does not have correct type.
|
||||
* Used to be part of lauxlib in Lua 5.1, was dropped from 5.2.
|
||||
\*-------------------------------------------------------------------------*/
|
||||
int auxiliar_typeerror (lua_State *L, int narg, const char *tname) {
|
||||
const char *msg = lua_pushfstring(L, "%s expected, got %s", tname,
|
||||
luaL_typename(L, narg));
|
||||
return luaL_argerror(L, narg, msg);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user