diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:44:20 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:44:20 -0300 |
| commit | 4aa9ad6514a98fd4e25015f29e04877e67d9772d (patch) | |
| tree | 1c4f47aef895ef6abf837e190204eb353b18be11 /lbuiltin.c | |
| parent | d76b1a0eefc51384c75ffc0b847c212ad98f20f8 (diff) | |
| download | lua-4aa9ad6514a98fd4e25015f29e04877e67d9772d.tar.gz lua-4aa9ad6514a98fd4e25015f29e04877e67d9772d.tar.bz2 lua-4aa9ad6514a98fd4e25015f29e04877e67d9772d.zip | |
functions must return explicit `nil' on failure
Diffstat (limited to 'lbuiltin.c')
| -rw-r--r-- | lbuiltin.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.103 2000/04/13 16:46:43 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.104 2000/04/13 18:08:18 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -223,7 +223,7 @@ void luaB_newtag (lua_State *L) { | |||
| 223 | 223 | ||
| 224 | void luaB_copytagmethods (lua_State *L) { | 224 | void luaB_copytagmethods (lua_State *L) { |
| 225 | lua_pushnumber(L, lua_copytagmethods(L, luaL_check_int(L, 1), | 225 | lua_pushnumber(L, lua_copytagmethods(L, luaL_check_int(L, 1), |
| 226 | luaL_check_int(L, 2))); | 226 | luaL_check_int(L, 2))); |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | void luaB_rawgettable (lua_State *L) { | 229 | void luaB_rawgettable (lua_State *L) { |
| @@ -296,7 +296,8 @@ void luaB_dostring (lua_State *L) { | |||
| 296 | lua_error(L, "`dostring' cannot run pre-compiled code"); | 296 | lua_error(L, "`dostring' cannot run pre-compiled code"); |
| 297 | if (lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)) == 0) | 297 | if (lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)) == 0) |
| 298 | passresults(L); | 298 | passresults(L); |
| 299 | /* else return no value */ | 299 | else |
| 300 | lua_pushnil(L); | ||
| 300 | } | 301 | } |
| 301 | 302 | ||
| 302 | 303 | ||
| @@ -304,7 +305,8 @@ void luaB_dofile (lua_State *L) { | |||
| 304 | const char *fname = luaL_opt_string(L, 1, NULL); | 305 | const char *fname = luaL_opt_string(L, 1, NULL); |
| 305 | if (lua_dofile(L, fname) == 0) | 306 | if (lua_dofile(L, fname) == 0) |
| 306 | passresults(L); | 307 | passresults(L); |
| 307 | /* else return no value */ | 308 | else |
| 309 | lua_pushnil(L); | ||
| 308 | } | 310 | } |
| 309 | 311 | ||
| 310 | 312 | ||
