commit 6dfdb765388da481a7020e44e7cfb253f9751699
parent 9a3c51cff1b925e125197e89a4c867c1d99ad1ba
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 12 Jul 1996 17:00:06 -0300
C functions don't need to "pushnil" to return nil value (this is
the default value).
Diffstat:
3 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/hash.c b/hash.c
@@ -3,7 +3,7 @@
** hash manager for lua
*/
-char *rcs_hash="$Id: hash.c,v 2.29 1996/02/14 18:25:04 roberto Exp roberto $";
+char *rcs_hash="$Id: hash.c,v 2.30 1996/05/06 14:30:27 roberto Exp roberto $";
#include "mem.h"
@@ -283,17 +283,11 @@ Object *lua_hashdefine (Hash *t, Object *ref)
static void hashnext (Hash *t, int i)
{
if (i >= nhash(t))
- {
- lua_pushnil(); lua_pushnil();
return;
- }
while (tag(ref(node(t,i))) == LUA_T_NIL || tag(val(node(t,i))) == LUA_T_NIL)
{
if (++i >= nhash(t))
- {
- lua_pushnil(); lua_pushnil();
return;
- }
}
luaI_pushobject(ref(node(t,i)));
luaI_pushobject(val(node(t,i)));
diff --git a/inout.c b/inout.c
@@ -5,7 +5,7 @@
** Also provides some predefined lua functions.
*/
-char *rcs_inout="$Id: inout.c,v 2.36 1996/03/19 22:28:37 roberto Exp roberto $";
+char *rcs_inout="$Id: inout.c,v 2.37 1996/05/28 21:07:32 roberto Exp $";
#include <stdio.h>
@@ -113,8 +113,6 @@ void lua_internaldostring (void)
lua_Object obj = lua_getparam (1);
if (lua_isstring(obj) && !lua_dostring(lua_getstring(obj)))
lua_pushnumber(1);
- else
- lua_pushnil();
}
/*
@@ -131,8 +129,6 @@ void lua_internaldofile (void)
/* else fname = NULL */
if (!lua_dofile(fname))
lua_pushnumber(1);
- else
- lua_pushnil();
}
@@ -218,8 +214,6 @@ void lua_obj2number (void)
lua_Object o = lua_getparam(1);
if (lua_isnumber(o))
lua_pushnumber(lua_getnumber(o));
- else
- lua_pushnil();
}
diff --git a/table.c b/table.c
@@ -3,7 +3,7 @@
** Module to control static tables
*/
-char *rcs_table="$Id: table.c,v 2.55 1996/05/28 21:07:32 roberto Exp roberto $";
+char *rcs_table="$Id: table.c,v 2.56 1996/06/18 21:12:23 roberto Exp roberto $";
#include "mem.h"
#include "opcode.h"
@@ -240,12 +240,7 @@ static void lua_nextvar (void)
else
next = luaI_findsymbolbyname(lua_getstring(o)) + 1;
while (next < lua_ntable && s_tag(next) == LUA_T_NIL) next++;
- if (next >= lua_ntable)
- {
- lua_pushnil();
- lua_pushnil();
- }
- else
+ if (next < lua_ntable)
{
lua_pushstring(lua_table[next].varname->str);
luaI_pushobject(&s_object(next));