diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-23 16:43:04 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-23 16:43:04 -0300 |
| commit | a1700bbc5022efc4ecb16d57f2ffb0afaed78bf4 (patch) | |
| tree | f86e1f2520be996cd0caa4b68fdb19155f26132e | |
| parent | 8876a1bf92bd4b3e2e04eca2aed198a0135d9282 (diff) | |
| download | lua-a1700bbc5022efc4ecb16d57f2ffb0afaed78bf4.tar.gz lua-a1700bbc5022efc4ecb16d57f2ffb0afaed78bf4.tar.bz2 lua-a1700bbc5022efc4ecb16d57f2ffb0afaed78bf4.zip | |
details
| -rw-r--r-- | lua.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.86 2002/05/15 18:57:44 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.87 2002/05/16 19:09:19 roberto Exp roberto $ |
| 3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -67,8 +67,7 @@ static void laction (int i) { | |||
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | static void report (int status) { | 69 | static void report (int status) { |
| 70 | if (status == 0) return; | 70 | if (status) { |
| 71 | else { | ||
| 72 | lua_getglobal(L, "_ALERT"); | 71 | lua_getglobal(L, "_ALERT"); |
| 73 | lua_pushvalue(L, -2); | 72 | lua_pushvalue(L, -2); |
| 74 | lua_pcall(L, 1, 0, 0); | 73 | lua_pcall(L, 1, 0, 0); |
| @@ -151,19 +150,20 @@ static int l_getargs (lua_State *l) { | |||
| 151 | } | 150 | } |
| 152 | 151 | ||
| 153 | 152 | ||
| 154 | static int file_input (const char *name) { | 153 | static int docall (int status) { |
| 155 | int status = lua_loadfile(L, name); | ||
| 156 | if (status == 0) status = lcall(1); | 154 | if (status == 0) status = lcall(1); |
| 157 | report(status); | 155 | report(status); |
| 158 | return status; | 156 | return status; |
| 159 | } | 157 | } |
| 160 | 158 | ||
| 161 | 159 | ||
| 160 | static int file_input (const char *name) { | ||
| 161 | return docall(lua_loadfile(L, name)); | ||
| 162 | } | ||
| 163 | |||
| 164 | |||
| 162 | static int dostring (const char *s, const char *name) { | 165 | static int dostring (const char *s, const char *name) { |
| 163 | int status = lua_loadbuffer(L, s, strlen(s), name); | 166 | return docall(lua_loadbuffer(L, s, strlen(s), name)); |
| 164 | if (status == 0) status = lcall(1); | ||
| 165 | report(status); | ||
| 166 | return status; | ||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | 169 | ||
