mirror of
https://github.com/lua/lua
synced 2024-12-24 19:36:50 +03:00
luaL_arg_check now is inlined
This commit is contained in:
parent
6ac047afc4
commit
9f043e8017
28
lauxlib.c
28
lauxlib.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lauxlib.c,v 1.6 1997/12/17 20:48:58 roberto Exp roberto $
|
** $Id: lauxlib.c,v 1.8 1998/01/09 15:06:07 roberto Exp $
|
||||||
** Auxiliar functions for building Lua libraries
|
** Auxiliar functions for building Lua libraries
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -8,25 +8,27 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Please Notice: This file uses only the oficial API of Lua
|
||||||
|
** Any function declared here could be written as an application
|
||||||
|
** function. With care, these functions can be used by other libraries.
|
||||||
|
*/
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
#include "luadebug.h"
|
#include "luadebug.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void luaL_arg_check (int cond, int numarg, char *extramsg)
|
void luaL_argerror (int numarg, char *extramsg)
|
||||||
{
|
{
|
||||||
if (!cond) {
|
char *funcname;
|
||||||
char *funcname;
|
lua_getobjname(lua_stackedfunction(0), &funcname);
|
||||||
lua_getobjname(lua_stackedfunction(0), &funcname);
|
if (funcname == NULL)
|
||||||
if (funcname == NULL)
|
funcname = "???";
|
||||||
funcname = "???";
|
if (extramsg == NULL)
|
||||||
if (extramsg == NULL)
|
luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
|
||||||
luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
|
else
|
||||||
else
|
luaL_verror("bad argument #%d to function `%.50s' (%.100s)",
|
||||||
luaL_verror("bad argument #%d to function `%.50s' (%.100s)",
|
numarg, funcname, extramsg);
|
||||||
numarg, funcname, extramsg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *luaL_check_string (int numArg)
|
char *luaL_check_string (int numArg)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lauxlib.h,v 1.4 1997/12/09 13:35:19 roberto Exp roberto $
|
** $Id: lauxlib.h,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $
|
||||||
** Auxiliar functions for building Lua libraries
|
** Auxiliar functions for building Lua libraries
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -17,8 +17,12 @@ struct luaL_reg {
|
|||||||
lua_CFunction func;
|
lua_CFunction func;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \
|
||||||
|
luaL_argerror(numarg,extramsg)
|
||||||
|
|
||||||
void luaL_openlib (struct luaL_reg *l, int n);
|
void luaL_openlib (struct luaL_reg *l, int n);
|
||||||
void luaL_arg_check (int cond, int numarg, char *extramsg);
|
void luaL_argerror (int numarg, char *extramsg);
|
||||||
char *luaL_check_string (int numArg);
|
char *luaL_check_string (int numArg);
|
||||||
char *luaL_opt_string (int numArg, char *def);
|
char *luaL_opt_string (int numArg, char *def);
|
||||||
double luaL_check_number (int numArg);
|
double luaL_check_number (int numArg);
|
||||||
|
Loading…
Reference in New Issue
Block a user