Browse Source

luaL_arg_check now is inlined

v5-2
Roberto Ierusalimschy 27 years ago
parent
commit
9f043e8017
  1. 10
      lauxlib.c
  2. 8
      lauxlib.h

10
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
** See Copyright Notice in lua.h
*/
@ -8,15 +8,18 @@
#include <stdarg.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 "lua.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;
lua_getobjname(lua_stackedfunction(0), &funcname);
if (funcname == NULL)
@ -27,7 +30,6 @@ void luaL_arg_check (int cond, int numarg, char *extramsg)
luaL_verror("bad argument #%d to function `%.50s' (%.100s)",
numarg, funcname, extramsg);
}
}
char *luaL_check_string (int numArg)
{

8
lauxlib.h

@ -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
** See Copyright Notice in lua.h
*/
@ -17,8 +17,12 @@ struct luaL_reg {
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_arg_check (int cond, int numarg, char *extramsg);
void luaL_argerror (int numarg, char *extramsg);
char *luaL_check_string (int numArg);
char *luaL_opt_string (int numArg, char *def);
double luaL_check_number (int numArg);

Loading…
Cancel
Save