diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-09 13:09:53 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-09 13:09:53 -0200 |
| commit | 9f043e801733b0a5019c4e6e2a72abaf9ad7c5b0 (patch) | |
| tree | 54f1ac9c81b072567955e7399376eec5cd745218 /lauxlib.c | |
| parent | 6ac047afc46cbee935587b5734ec37d2e667a598 (diff) | |
| download | lua-9f043e801733b0a5019c4e6e2a72abaf9ad7c5b0.tar.gz lua-9f043e801733b0a5019c4e6e2a72abaf9ad7c5b0.tar.bz2 lua-9f043e801733b0a5019c4e6e2a72abaf9ad7c5b0.zip | |
luaL_arg_check now is inlined
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 28 |
1 files changed, 15 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.6 1997/12/17 20:48:58 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.8 1998/01/09 15:06:07 roberto Exp $ |
| 3 | ** Auxiliar functions for building Lua libraries | 3 | ** Auxiliar functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -8,25 +8,27 @@ | |||
| 8 | #include <stdarg.h> | 8 | #include <stdarg.h> |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| 10 | 10 | ||
| 11 | /* Please Notice: This file uses only the oficial API of Lua | ||
| 12 | ** Any function declared here could be written as an application | ||
| 13 | ** function. With care, these functions can be used by other libraries. | ||
| 14 | */ | ||
| 11 | #include "lauxlib.h" | 15 | #include "lauxlib.h" |
| 12 | #include "lua.h" | 16 | #include "lua.h" |
| 13 | #include "luadebug.h" | 17 | #include "luadebug.h" |
| 14 | 18 | ||
| 15 | 19 | ||
| 16 | 20 | ||
| 17 | void luaL_arg_check (int cond, int numarg, char *extramsg) | 21 | void luaL_argerror (int numarg, char *extramsg) |
| 18 | { | 22 | { |
| 19 | if (!cond) { | 23 | char *funcname; |
| 20 | char *funcname; | 24 | lua_getobjname(lua_stackedfunction(0), &funcname); |
| 21 | lua_getobjname(lua_stackedfunction(0), &funcname); | 25 | if (funcname == NULL) |
| 22 | if (funcname == NULL) | 26 | funcname = "???"; |
| 23 | funcname = "???"; | 27 | if (extramsg == NULL) |
| 24 | if (extramsg == NULL) | 28 | luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname); |
| 25 | luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname); | 29 | else |
| 26 | else | 30 | luaL_verror("bad argument #%d to function `%.50s' (%.100s)", |
| 27 | luaL_verror("bad argument #%d to function `%.50s' (%.100s)", | 31 | numarg, funcname, extramsg); |
| 28 | numarg, funcname, extramsg); | ||
| 29 | } | ||
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | char *luaL_check_string (int numArg) | 34 | char *luaL_check_string (int numArg) |
