diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-07-12 15:15:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-07-12 15:15:11 -0300 |
commit | a569099b7053664f6945762aec14ff0a4a975d7b (patch) | |
tree | 2f0611fecf2167ea83e8813eafaab00bcbec9c1f /lbaselib.c | |
parent | 20131e54d3631b0c3ce493b71b38f32245408974 (diff) | |
download | lua-a569099b7053664f6945762aec14ff0a4a975d7b.tar.gz lua-a569099b7053664f6945762aec14ff0a4a975d7b.tar.bz2 lua-a569099b7053664f6945762aec14ff0a4a975d7b.zip |
no more path for loadfile + function lists sorted
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 48 |
1 files changed, 20 insertions, 28 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.178 2005/05/25 13:21:26 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.179 2005/07/07 15:48:29 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 | */ |
@@ -270,15 +270,7 @@ static int luaB_loadstring (lua_State *L) { | |||
270 | 270 | ||
271 | static int luaB_loadfile (lua_State *L) { | 271 | static int luaB_loadfile (lua_State *L) { |
272 | const char *fname = luaL_optstring(L, 1, NULL); | 272 | const char *fname = luaL_optstring(L, 1, NULL); |
273 | const char *path = luaL_optstring(L, 2, NULL); | 273 | return load_aux(L, luaL_loadfile(L, fname)); |
274 | int status; | ||
275 | if (path == NULL) | ||
276 | status = luaL_loadfile(L, fname); | ||
277 | else { | ||
278 | fname = luaL_searchpath(L, fname, path); | ||
279 | status = (fname) ? luaL_loadfile(L, fname) : 1; | ||
280 | } | ||
281 | return load_aux(L, status); | ||
282 | } | 274 | } |
283 | 275 | ||
284 | 276 | ||
@@ -438,30 +430,30 @@ static int luaB_newproxy (lua_State *L) { | |||
438 | 430 | ||
439 | 431 | ||
440 | static const luaL_reg base_funcs[] = { | 432 | static const luaL_reg base_funcs[] = { |
433 | {"assert", luaB_assert}, | ||
434 | {"collectgarbage", luaB_collectgarbage}, | ||
435 | {"dofile", luaB_dofile}, | ||
441 | {"error", luaB_error}, | 436 | {"error", luaB_error}, |
442 | {"getmetatable", luaB_getmetatable}, | 437 | {"gcinfo", luaB_gcinfo}, |
443 | {"setmetatable", luaB_setmetatable}, | ||
444 | {"getfenv", luaB_getfenv}, | 438 | {"getfenv", luaB_getfenv}, |
445 | {"setfenv", luaB_setfenv}, | 439 | {"getmetatable", luaB_getmetatable}, |
440 | {"loadfile", luaB_loadfile}, | ||
441 | {"load", luaB_load}, | ||
442 | {"loadstring", luaB_loadstring}, | ||
446 | {"next", luaB_next}, | 443 | {"next", luaB_next}, |
444 | {"pcall", luaB_pcall}, | ||
447 | {"print", luaB_print}, | 445 | {"print", luaB_print}, |
446 | {"rawequal", luaB_rawequal}, | ||
447 | {"rawget", luaB_rawget}, | ||
448 | {"rawset", luaB_rawset}, | ||
449 | {"select", luaB_select}, | ||
450 | {"setfenv", luaB_setfenv}, | ||
451 | {"setmetatable", luaB_setmetatable}, | ||
448 | {"tonumber", luaB_tonumber}, | 452 | {"tonumber", luaB_tonumber}, |
449 | {"tostring", luaB_tostring}, | 453 | {"tostring", luaB_tostring}, |
450 | {"type", luaB_type}, | 454 | {"type", luaB_type}, |
451 | {"assert", luaB_assert}, | ||
452 | {"unpack", luaB_unpack}, | 455 | {"unpack", luaB_unpack}, |
453 | {"select", luaB_select}, | ||
454 | {"rawequal", luaB_rawequal}, | ||
455 | {"rawget", luaB_rawget}, | ||
456 | {"rawset", luaB_rawset}, | ||
457 | {"pcall", luaB_pcall}, | ||
458 | {"xpcall", luaB_xpcall}, | 456 | {"xpcall", luaB_xpcall}, |
459 | {"collectgarbage", luaB_collectgarbage}, | ||
460 | {"gcinfo", luaB_gcinfo}, | ||
461 | {"loadfile", luaB_loadfile}, | ||
462 | {"dofile", luaB_dofile}, | ||
463 | {"loadstring", luaB_loadstring}, | ||
464 | {"load", luaB_load}, | ||
465 | {NULL, NULL} | 457 | {NULL, NULL} |
466 | }; | 458 | }; |
467 | 459 | ||
@@ -589,11 +581,11 @@ static int luaB_corunning (lua_State *L) { | |||
589 | 581 | ||
590 | static const luaL_reg co_funcs[] = { | 582 | static const luaL_reg co_funcs[] = { |
591 | {"create", luaB_cocreate}, | 583 | {"create", luaB_cocreate}, |
592 | {"wrap", luaB_cowrap}, | ||
593 | {"resume", luaB_coresume}, | 584 | {"resume", luaB_coresume}, |
594 | {"yield", luaB_yield}, | ||
595 | {"status", luaB_costatus}, | ||
596 | {"running", luaB_corunning}, | 585 | {"running", luaB_corunning}, |
586 | {"status", luaB_costatus}, | ||
587 | {"wrap", luaB_cowrap}, | ||
588 | {"yield", luaB_yield}, | ||
597 | {NULL, NULL} | 589 | {NULL, NULL} |
598 | }; | 590 | }; |
599 | 591 | ||