diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-05 20:36:52 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-05 20:36:52 -0200 |
| commit | d070506a255cc7cc33842a7bb97e1405cfb048aa (patch) | |
| tree | b6230d87e080a17d675ecb88586eb6a6f1e7404a /lauxlib.c | |
| parent | 0a87d9d3346bcf74d84e4d6bae775bceecef096f (diff) | |
| download | lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.gz lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.bz2 lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.zip | |
new function luaL_errstr
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -21,6 +21,18 @@ | |||
| 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 open file", | ||
| 29 | "syntax error", | ||
| 30 | "memory allocation error", | ||
| 31 | "error in error handling" | ||
| 32 | }; | ||
| 33 | return errstr[errcode]; | ||
| 34 | } | ||
| 35 | |||
| 24 | 36 | ||
| 25 | LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { | 37 | LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { |
| 26 | int i; | 38 | int i; |
