diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:11:41 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:11:41 -0300 |
| commit | ad7103ea3aed7f40a5cf7055af253b34320134bc (patch) | |
| tree | 978a750ba9c4cb990ece1fe6280f3806acbe6fce /lbaselib.c | |
| parent | 0079e0f57ce2bd4dc40b9b7c5831c58764a7938f (diff) | |
| download | lua-ad7103ea3aed7f40a5cf7055af253b34320134bc.tar.gz lua-ad7103ea3aed7f40a5cf7055af253b34320134bc.tar.bz2 lua-ad7103ea3aed7f40a5cf7055af253b34320134bc.zip | |
lua_load* defined in auxlib (and so renamed to luaL_load*)
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.74 2002/05/16 18:39:46 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.75 2002/05/16 19:09:19 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -174,7 +174,7 @@ static int luaB_nexti (lua_State *L) { | |||
| 174 | else { /* `for' step */ | 174 | else { /* `for' step */ |
| 175 | i++; /* next value */ | 175 | i++; /* next value */ |
| 176 | lua_pushnumber(L, i); | 176 | lua_pushnumber(L, i); |
| 177 | lua_rawgeti(L, 1, i); | 177 | lua_rawgeti(L, 1, (int)i); |
| 178 | return (lua_isnil(L, -1)) ? 0 : 2; | 178 | return (lua_isnil(L, -1)) ? 0 : 2; |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| @@ -194,20 +194,20 @@ static int luaB_loadstring (lua_State *L) { | |||
| 194 | size_t l; | 194 | size_t l; |
| 195 | const char *s = luaL_check_lstr(L, 1, &l); | 195 | const char *s = luaL_check_lstr(L, 1, &l); |
| 196 | const char *chunkname = luaL_opt_string(L, 2, s); | 196 | const char *chunkname = luaL_opt_string(L, 2, s); |
| 197 | return passresults(L, lua_loadbuffer(L, s, l, chunkname)); | 197 | return passresults(L, luaL_loadbuffer(L, s, l, chunkname)); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | 200 | ||
| 201 | static int luaB_loadfile (lua_State *L) { | 201 | static int luaB_loadfile (lua_State *L) { |
| 202 | const char *fname = luaL_opt_string(L, 1, NULL); | 202 | const char *fname = luaL_opt_string(L, 1, NULL); |
| 203 | return passresults(L, lua_loadfile(L, fname)); | 203 | return passresults(L, luaL_loadfile(L, fname)); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | 206 | ||
| 207 | static int luaB_assert (lua_State *L) { | 207 | static int luaB_assert (lua_State *L) { |
| 208 | luaL_check_any(L, 1); | 208 | luaL_check_any(L, 1); |
| 209 | if (!lua_toboolean(L, 1)) | 209 | if (!lua_toboolean(L, 1)) |
| 210 | return luaL_verror(L, "assertion failed! %s", luaL_opt_string(L, 2, "")); | 210 | return luaL_verror(L, "%s", luaL_opt_string(L, 2, "assertion failed!")); |
| 211 | lua_settop(L, 1); | 211 | lua_settop(L, 1); |
| 212 | return 1; | 212 | return 1; |
| 213 | } | 213 | } |
| @@ -349,7 +349,7 @@ static int luaB_require (lua_State *L) { | |||
| 349 | lua_settop(L, 3); /* reset stack position */ | 349 | lua_settop(L, 3); /* reset stack position */ |
| 350 | if ((path = pushnextpath(L, path)) == NULL) break; | 350 | if ((path = pushnextpath(L, path)) == NULL) break; |
| 351 | pushcomposename(L); | 351 | pushcomposename(L); |
| 352 | status = lua_loadfile(L, lua_tostring(L, -1)); /* try to load it */ | 352 | status = luaL_loadfile(L, lua_tostring(L, -1)); /* try to load it */ |
| 353 | } | 353 | } |
| 354 | } | 354 | } |
| 355 | switch (status) { | 355 | switch (status) { |
