diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-01 17:48:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-01 17:48:12 -0300 |
commit | 751cd867d3e0338279fa6f3390c8b7ddc0108659 (patch) | |
tree | 726f6f3cd49109382b2c0d7ee6a1e0fea740afbd /lauxlib.c | |
parent | b36b2a061c88be22e36900146cbcad39bab07f5d (diff) | |
download | lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.gz lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.bz2 lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.zip |
new way to handle errors
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.65 2002/04/04 20:25:55 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.66 2002/04/16 12:00:02 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,19 +21,6 @@ | |||
21 | #include "lualib.h" | 21 | #include "lualib.h" |
22 | 22 | ||
23 | 23 | ||
24 | LUALIB_API const char *luaL_errstr (int errcode) { | ||
25 | static const char *const errstr[] = { | ||
26 | "ok", | ||
27 | "run-time error", | ||
28 | "cannot read file", | ||
29 | "syntax error", | ||
30 | "not enough memory", | ||
31 | "error in error handling" | ||
32 | }; | ||
33 | return errstr[errcode]; | ||
34 | } | ||
35 | |||
36 | |||
37 | LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { | 24 | LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { |
38 | int i; | 25 | int i; |
39 | for (i=0; list[i]; i++) | 26 | for (i=0; list[i]; i++) |
@@ -42,6 +29,7 @@ LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { | |||
42 | return -1; /* name not found */ | 29 | return -1; /* name not found */ |
43 | } | 30 | } |
44 | 31 | ||
32 | |||
45 | LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) { | 33 | LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) { |
46 | lua_Debug ar; | 34 | lua_Debug ar; |
47 | lua_getstack(L, 0, &ar); | 35 | lua_getstack(L, 0, &ar); |