summaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-04-23 13:35:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-04-23 13:35:45 -0300
commit572a69b6afbd368beab8844bc876b0f9690b5253 (patch)
treef2785c52e1ee9bab5b68823b9481af2510a90829 /lbaselib.c
parentbeee01b170c5fea9ed4527b28b9221d2df1baaba (diff)
downloadlua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.gz
lua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.bz2
lua-572a69b6afbd368beab8844bc876b0f9690b5253.zip
name changes
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 119d80f7..8f2ad922 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.33 2001/04/11 14:42:41 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.34 2001/04/11 18:39:37 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*/
@@ -144,7 +144,7 @@ static int gettag (lua_State *L, int narg) {
144 return (int)lua_tonumber(L, narg); 144 return (int)lua_tonumber(L, narg);
145 case LUA_TSTRING: { 145 case LUA_TSTRING: {
146 const l_char *name = lua_tostring(L, narg); 146 const l_char *name = lua_tostring(L, narg);
147 int tag = lua_type2tag(L, name); 147 int tag = lua_name2tag(L, name);
148 if (tag == LUA_TNONE) 148 if (tag == LUA_TNONE)
149 luaL_verror(L, l_s("'%.30s' is not a valid type name"), name); 149 luaL_verror(L, l_s("'%.30s' is not a valid type name"), name);
150 return tag; 150 return tag;
@@ -194,7 +194,7 @@ static int luaB_weakmode (lua_State *L) {
194 194
195static int luaB_newtype (lua_State *L) { 195static int luaB_newtype (lua_State *L) {
196 const l_char *name = luaL_opt_string(L, 1, NULL); 196 const l_char *name = luaL_opt_string(L, 1, NULL);
197 lua_pushnumber(L, lua_newtype(L, name, LUA_TTABLE)); 197 lua_pushnumber(L, lua_newxtype(L, name, LUA_TTABLE));
198 return 1; 198 return 1;
199} 199}
200 200
@@ -267,14 +267,14 @@ static int luaB_collectgarbage (lua_State *L) {
267 267
268static int luaB_type (lua_State *L) { 268static int luaB_type (lua_State *L) {
269 luaL_checkany(L, 1); 269 luaL_checkany(L, 1);
270 lua_pushstring(L, lua_typename(L, lua_type(L, 1))); 270 lua_pushstring(L, lua_tag2name(L, lua_type(L, 1)));
271 return 1; 271 return 1;
272} 272}
273 273
274 274
275static int luaB_xtype (lua_State *L) { 275static int luaB_xtype (lua_State *L) {
276 luaL_checkany(L, 1); 276 luaL_checkany(L, 1);
277 lua_pushstring(L, lua_xtype(L, 1)); 277 lua_pushstring(L, lua_xtypename(L, 1));
278 return 1; 278 return 1;
279} 279}
280 280
@@ -406,19 +406,19 @@ static int luaB_require (lua_State *L) {
406} 406}
407 407
408 408
409static int aux_unwrap (lua_State *L, int arg) { 409static int aux_unpack (lua_State *L, int arg) {
410 int n, i; 410 int n, i;
411 luaL_checktype(L, arg, LUA_TTABLE); 411 luaL_checktype(L, arg, LUA_TTABLE);
412 n = lua_getn(L, arg); 412 n = lua_getn(L, arg);
413 luaL_checkstack(L, n, l_s("table too big to unwrap")); 413 luaL_checkstack(L, n, l_s("table too big to unpack"));
414 for (i=1; i<=n; i++) /* push arg[1...n] */ 414 for (i=1; i<=n; i++) /* push arg[1...n] */
415 lua_rawgeti(L, arg, i); 415 lua_rawgeti(L, arg, i);
416 return n; 416 return n;
417} 417}
418 418
419 419
420static int luaB_unwrap (lua_State *L) { 420static int luaB_unpack (lua_State *L) {
421 return aux_unwrap(L, 1); 421 return aux_unpack(L, 1);
422} 422}
423 423
424 424
@@ -437,7 +437,7 @@ static int luaB_call (lua_State *L) {
437 oldtop = lua_gettop(L); /* top before function-call preparation */ 437 oldtop = lua_gettop(L); /* top before function-call preparation */
438 /* push function */ 438 /* push function */
439 lua_pushvalue(L, 1); 439 lua_pushvalue(L, 1);
440 n = aux_unwrap(L, 2); /* push arg[1...n] */ 440 n = aux_unpack(L, 2); /* push arg[1...n] */
441 status = lua_call(L, n, LUA_MULTRET); 441 status = lua_call(L, n, LUA_MULTRET);
442 if (err != 0) { /* restore old error method */ 442 if (err != 0) { /* restore old error method */
443 lua_pushvalue(L, err); 443 lua_pushvalue(L, err);
@@ -466,13 +466,13 @@ static int luaB_tostring (lua_State *L) {
466 lua_pushvalue(L, 1); 466 lua_pushvalue(L, 1);
467 return 1; 467 return 1;
468 case LUA_TTABLE: 468 case LUA_TTABLE:
469 sprintf(buff, l_s("%.40s: %p"), lua_xtype(L, 1), lua_topointer(L, 1)); 469 sprintf(buff, l_s("%.40s: %p"), lua_xtypename(L, 1), lua_topointer(L, 1));
470 break; 470 break;
471 case LUA_TFUNCTION: 471 case LUA_TFUNCTION:
472 sprintf(buff, l_s("function: %p"), lua_topointer(L, 1)); 472 sprintf(buff, l_s("function: %p"), lua_topointer(L, 1));
473 break; 473 break;
474 case LUA_TUSERDATA: { 474 case LUA_TUSERDATA: {
475 const l_char *t = lua_xtype(L, 1); 475 const l_char *t = lua_xtypename(L, 1);
476 if (strcmp(t, l_s("userdata")) == 0) 476 if (strcmp(t, l_s("userdata")) == 0)
477 sprintf(buff, l_s("userdata(%d): %p"), lua_tag(L, 1), 477 sprintf(buff, l_s("userdata(%d): %p"), lua_tag(L, 1),
478 lua_touserdata(L, 1)); 478 lua_touserdata(L, 1));
@@ -793,7 +793,7 @@ static const luaL_reg base_funcs[] = {
793 {l_s("sort"), luaB_sort}, 793 {l_s("sort"), luaB_sort},
794 {l_s("tinsert"), luaB_tinsert}, 794 {l_s("tinsert"), luaB_tinsert},
795 {l_s("tremove"), luaB_tremove}, 795 {l_s("tremove"), luaB_tremove},
796 {l_s("unwrap"), luaB_unwrap}, 796 {l_s("unpack"), luaB_unpack},
797 {l_s("xtype"), luaB_xtype}, 797 {l_s("xtype"), luaB_xtype},
798 {l_s("weakmode"), luaB_weakmode} 798 {l_s("weakmode"), luaB_weakmode}
799}; 799};