C functions and userdata also have environments

This commit is contained in:
Roberto Ierusalimschy
2005-02-18 10:40:02 -02:00
parent 73d7640244
commit 7d45a5f48f
17 changed files with 206 additions and 111 deletions

4
ldo.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 2.12 2004/12/01 15:52:54 roberto Exp roberto $
** $Id: ldo.c,v 2.13 2004/12/03 20:35:33 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -474,7 +474,7 @@ static void f_parser (lua_State *L, void *ud) {
luaC_checkGC(L);
tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
&p->buff, p->name);
cl = luaF_newLclosure(L, tf->nups, gt(L));
cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
cl->l.p = tf;
for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */
cl->l.upvals[i] = luaF_newupval(L);