This commit is contained in:
Roberto Ierusalimschy 2002-04-02 17:43:08 -03:00
parent cd99bbcd0d
commit 13ab5a6bb1
6 changed files with 19 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lcode.c,v 1.92 2002/03/21 20:31:43 roberto Exp roberto $ ** $Id: lcode.c,v 1.93 2002/03/25 17:47:14 roberto Exp roberto $
** Code generator for Lua ** Code generator for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -704,7 +704,7 @@ void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
luaK_exp2nextreg(fs, e2); luaK_exp2nextreg(fs, e2);
freeexp(fs, e2); freeexp(fs, e2);
freeexp(fs, e1); freeexp(fs, e1);
e1->info = luaK_codeABC(fs, codes[op], 0, e1->info, e2->info); e1->info = luaK_codeABC(fs, OP_CONCAT, 0, e1->info, e2->info);
e1->k = VRELOCABLE; e1->k = VRELOCABLE;
} }
break; break;

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lcode.h,v 1.28 2002/03/08 19:10:32 roberto Exp roberto $ ** $Id: lcode.h,v 1.29 2002/03/21 20:31:43 roberto Exp roberto $
** Code generator for Lua ** Code generator for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -26,7 +26,8 @@
typedef enum BinOpr { typedef enum BinOpr {
OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW, OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW,
OPR_CONCAT, OPR_CONCAT,
OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE, OPR_NE, OPR_EQ,
OPR_LT, OPR_LE, OPR_GT, OPR_GE,
OPR_AND, OPR_OR, OPR_AND, OPR_OR,
OPR_NOBINOPR OPR_NOBINOPR
} BinOpr; } BinOpr;

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldblib.c,v 1.44 2002/03/20 12:54:08 roberto Exp roberto $ ** $Id: ldblib.c,v 1.45 2002/03/27 15:30:41 roberto Exp roberto $
** Interface from Lua to its debug API ** Interface from Lua to its debug API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -264,7 +264,7 @@ static const luaL_reg dblib[] = {
LUALIB_API int lua_dblibopen (lua_State *L) { LUALIB_API int lua_dblibopen (lua_State *L) {
luaL_opennamedlib(L, "dbg", dblib); luaL_opennamedlib(L, "dbg", dblib, 0);
lua_register(L, LUA_ERRORMESSAGE, errorfb); lua_register(L, LUA_ERRORMESSAGE, errorfb);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lmathlib.c,v 1.40 2001/12/05 20:15:18 roberto Exp roberto $ ** $Id: lmathlib.c,v 1.41 2002/03/20 12:54:08 roberto Exp roberto $
** Standard mathematical library ** Standard mathematical library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -234,7 +234,7 @@ static const luaL_reg mathlib[] = {
LUALIB_API int lua_mathlibopen (lua_State *L) { LUALIB_API int lua_mathlibopen (lua_State *L) {
lua_pushliteral(L, "math"); lua_pushliteral(L, "math");
lua_newtable(L); lua_newtable(L);
luaL_openlib(L, mathlib); luaL_openlib(L, mathlib, 0);
lua_pushliteral(L, "pi"); lua_pushliteral(L, "pi");
lua_pushnumber(L, PI); lua_pushnumber(L, PI);
lua_settable(L, -3); lua_settable(L, -3);

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lstrlib.c,v 1.78 2002/03/11 13:29:40 roberto Exp roberto $ ** $Id: lstrlib.c,v 1.79 2002/03/20 12:54:08 roberto Exp roberto $
** Standard library for string operations and pattern-matching ** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -727,7 +727,7 @@ static const luaL_reg strlib[] = {
** Open string library ** Open string library
*/ */
LUALIB_API int lua_strlibopen (lua_State *L) { LUALIB_API int lua_strlibopen (lua_State *L) {
luaL_opennamedlib(L, "str", strlib); luaL_opennamedlib(L, "str", strlib, 0);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltests.c,v 1.113 2002/03/20 12:54:08 roberto Exp roberto $ ** $Id: ltests.c,v 1.114 2002/03/25 17:47:14 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation ** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -349,8 +349,10 @@ static int unref (lua_State *L) {
static int metatable (lua_State *L) { static int metatable (lua_State *L) {
luaL_check_any(L, 1); luaL_check_any(L, 1);
if (lua_isnone(L, 2)) if (lua_isnone(L, 2)) {
lua_getmetatable(L, 1); if (lua_getmetatable(L, 1) == 0)
lua_pushnil(L);
}
else { else {
lua_settop(L, 2); lua_settop(L, 2);
luaL_check_type(L, 2, LUA_TTABLE); luaL_check_type(L, 2, LUA_TTABLE);
@ -627,7 +629,8 @@ static int testC (lua_State *L) {
lua_setmetatable(L, getnum); lua_setmetatable(L, getnum);
} }
else if EQ("getmetatable") { else if EQ("getmetatable") {
lua_getmetatable(L, getnum); if (lua_getmetatable(L, getnum) == 0)
lua_pushnil(L);
} }
else if EQ("type") { else if EQ("type") {
lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); lua_pushstring(L, lua_typename(L, lua_type(L, getnum)));
@ -682,7 +685,7 @@ static void fim (void) {
void luaB_opentests (lua_State *L) { void luaB_opentests (lua_State *L) {
*cast(int **, L) = &islocked; /* init lock */ *cast(int **, L) = &islocked; /* init lock */
lua_state = L; /* keep first state to be opened */ lua_state = L; /* keep first state to be opened */
luaL_opennamedlib(L, "T", tests_funcs); luaL_opennamedlib(L, "T", tests_funcs, 0);
atexit(fim); atexit(fim);
} }