aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-03-06 17:09:38 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-03-06 17:09:38 -0300
commit6d4db86888ea8ef06b78646f2631891c9e4c7a2b (patch)
tree7a7b19dc6b3d786f4f974e702bf69eac9775b70f /ltests.c
parente9a38203700865d36c3b2861200674a21930c1b5 (diff)
downloadlua-6d4db86888ea8ef06b78646f2631891c9e4c7a2b.tar.gz
lua-6d4db86888ea8ef06b78646f2631891c9e4c7a2b.tar.bz2
lua-6d4db86888ea8ef06b78646f2631891c9e4c7a2b.zip
open functions are lua_Cfunctions
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/ltests.c b/ltests.c
index bf609156..4d3cd1e9 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.72 2001/02/23 17:17:25 roberto Exp roberto $ 2** $Id: ltests.c,v 1.73 2001/03/02 17:27:50 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -417,15 +417,12 @@ static int newstate (lua_State *L) {
417} 417}
418 418
419static int loadlib (lua_State *L) { 419static int loadlib (lua_State *L) {
420 lua_State *L1 = (lua_State *)lua_touserdata(L, 1); 420 lua_State *L1 = (lua_State *)(unsigned long)luaL_check_number(L, 1);
421 switch (*luaL_check_string(L, 2)) { 421 lua_register(L1, "mathlibopen", lua_mathlibopen);
422 case l_c('m'): lua_mathlibopen(L1); break; 422 lua_register(L1, "strlibopen", lua_strlibopen);
423 case l_c('s'): lua_strlibopen(L1); break; 423 lua_register(L1, "iolibopen", lua_iolibopen);
424 case l_c('i'): lua_iolibopen(L1); break; 424 lua_register(L1, "dblibopen", lua_dblibopen);
425 case l_c('d'): lua_dblibopen(L1); break; 425 lua_register(L1, "baselibopen", lua_baselibopen);
426 case l_c('b'): lua_baselibopen(L1); break;
427 default: luaL_argerror(L, 2, l_s("invalid option"));
428 }
429 return 0; 426 return 0;
430} 427}
431 428
@@ -451,6 +448,7 @@ static int doremote (lua_State *L) {
451 int i = 0; 448 int i = 0;
452 while (!lua_isnull(L1, ++i)) 449 while (!lua_isnull(L1, ++i))
453 lua_pushstring(L, lua_tostring(L1, i)); 450 lua_pushstring(L, lua_tostring(L1, i));
451 lua_pop(L1, i-1);
454 return i-1; 452 return i-1;
455 } 453 }
456} 454}