diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-02 17:43:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-02 17:43:08 -0300 |
commit | 13ab5a6bb1258d640bda2e6d776d5a38f3fa867b (patch) | |
tree | 22e8c2e5c1d10001d0abdeced6046e4489962f27 | |
parent | cd99bbcd0d88e7b5864ea9c9634ce8abd9bdedda (diff) | |
download | lua-13ab5a6bb1258d640bda2e6d776d5a38f3fa867b.tar.gz lua-13ab5a6bb1258d640bda2e6d776d5a38f3fa867b.tar.bz2 lua-13ab5a6bb1258d640bda2e6d776d5a38f3fa867b.zip |
details
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | lcode.h | 5 | ||||
-rw-r--r-- | ldblib.c | 4 | ||||
-rw-r--r-- | lmathlib.c | 4 | ||||
-rw-r--r-- | lstrlib.c | 4 | ||||
-rw-r--r-- | ltests.c | 13 |
6 files changed, 19 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 1.92 2002/03/21 20:31:43 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.93 2002/03/25 17:47:14 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -704,7 +704,7 @@ void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { | |||
704 | luaK_exp2nextreg(fs, e2); | 704 | luaK_exp2nextreg(fs, e2); |
705 | freeexp(fs, e2); | 705 | freeexp(fs, e2); |
706 | freeexp(fs, e1); | 706 | freeexp(fs, e1); |
707 | e1->info = luaK_codeABC(fs, codes[op], 0, e1->info, e2->info); | 707 | e1->info = luaK_codeABC(fs, OP_CONCAT, 0, e1->info, e2->info); |
708 | e1->k = VRELOCABLE; | 708 | e1->k = VRELOCABLE; |
709 | } | 709 | } |
710 | break; | 710 | break; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.h,v 1.28 2002/03/08 19:10:32 roberto Exp roberto $ | 2 | ** $Id: lcode.h,v 1.29 2002/03/21 20:31:43 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -26,7 +26,8 @@ | |||
26 | typedef enum BinOpr { | 26 | typedef enum BinOpr { |
27 | OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW, | 27 | OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW, |
28 | OPR_CONCAT, | 28 | OPR_CONCAT, |
29 | OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE, | 29 | OPR_NE, OPR_EQ, |
30 | OPR_LT, OPR_LE, OPR_GT, OPR_GE, | ||
30 | OPR_AND, OPR_OR, | 31 | OPR_AND, OPR_OR, |
31 | OPR_NOBINOPR | 32 | OPR_NOBINOPR |
32 | } BinOpr; | 33 | } BinOpr; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.44 2002/03/20 12:54:08 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.45 2002/03/27 15:30:41 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -264,7 +264,7 @@ static const luaL_reg dblib[] = { | |||
264 | 264 | ||
265 | 265 | ||
266 | LUALIB_API int lua_dblibopen (lua_State *L) { | 266 | LUALIB_API int lua_dblibopen (lua_State *L) { |
267 | luaL_opennamedlib(L, "dbg", dblib); | 267 | luaL_opennamedlib(L, "dbg", dblib, 0); |
268 | lua_register(L, LUA_ERRORMESSAGE, errorfb); | 268 | lua_register(L, LUA_ERRORMESSAGE, errorfb); |
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.40 2001/12/05 20:15:18 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.41 2002/03/20 12:54:08 roberto Exp roberto $ |
3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -234,7 +234,7 @@ static const luaL_reg mathlib[] = { | |||
234 | LUALIB_API int lua_mathlibopen (lua_State *L) { | 234 | LUALIB_API int lua_mathlibopen (lua_State *L) { |
235 | lua_pushliteral(L, "math"); | 235 | lua_pushliteral(L, "math"); |
236 | lua_newtable(L); | 236 | lua_newtable(L); |
237 | luaL_openlib(L, mathlib); | 237 | luaL_openlib(L, mathlib, 0); |
238 | lua_pushliteral(L, "pi"); | 238 | lua_pushliteral(L, "pi"); |
239 | lua_pushnumber(L, PI); | 239 | lua_pushnumber(L, PI); |
240 | lua_settable(L, -3); | 240 | lua_settable(L, -3); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.78 2002/03/11 13:29:40 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.79 2002/03/20 12:54:08 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -727,7 +727,7 @@ static const luaL_reg strlib[] = { | |||
727 | ** Open string library | 727 | ** Open string library |
728 | */ | 728 | */ |
729 | LUALIB_API int lua_strlibopen (lua_State *L) { | 729 | LUALIB_API int lua_strlibopen (lua_State *L) { |
730 | luaL_opennamedlib(L, "str", strlib); | 730 | luaL_opennamedlib(L, "str", strlib, 0); |
731 | return 0; | 731 | return 0; |
732 | } | 732 | } |
733 | 733 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.113 2002/03/20 12:54:08 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.114 2002/03/25 17:47:14 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 | */ |
@@ -349,8 +349,10 @@ static int unref (lua_State *L) { | |||
349 | 349 | ||
350 | static int metatable (lua_State *L) { | 350 | static int metatable (lua_State *L) { |
351 | luaL_check_any(L, 1); | 351 | luaL_check_any(L, 1); |
352 | if (lua_isnone(L, 2)) | 352 | if (lua_isnone(L, 2)) { |
353 | lua_getmetatable(L, 1); | 353 | if (lua_getmetatable(L, 1) == 0) |
354 | lua_pushnil(L); | ||
355 | } | ||
354 | else { | 356 | else { |
355 | lua_settop(L, 2); | 357 | lua_settop(L, 2); |
356 | luaL_check_type(L, 2, LUA_TTABLE); | 358 | luaL_check_type(L, 2, LUA_TTABLE); |
@@ -627,7 +629,8 @@ static int testC (lua_State *L) { | |||
627 | lua_setmetatable(L, getnum); | 629 | lua_setmetatable(L, getnum); |
628 | } | 630 | } |
629 | else if EQ("getmetatable") { | 631 | else if EQ("getmetatable") { |
630 | lua_getmetatable(L, getnum); | 632 | if (lua_getmetatable(L, getnum) == 0) |
633 | lua_pushnil(L); | ||
631 | } | 634 | } |
632 | else if EQ("type") { | 635 | else if EQ("type") { |
633 | lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); | 636 | lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); |
@@ -682,7 +685,7 @@ static void fim (void) { | |||
682 | void luaB_opentests (lua_State *L) { | 685 | void luaB_opentests (lua_State *L) { |
683 | *cast(int **, L) = &islocked; /* init lock */ | 686 | *cast(int **, L) = &islocked; /* init lock */ |
684 | lua_state = L; /* keep first state to be opened */ | 687 | lua_state = L; /* keep first state to be opened */ |
685 | luaL_opennamedlib(L, "T", tests_funcs); | 688 | luaL_opennamedlib(L, "T", tests_funcs, 0); |
686 | atexit(fim); | 689 | atexit(fim); |
687 | } | 690 | } |
688 | 691 | ||