aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-09-07 14:39:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-09-07 14:39:10 -0300
commitabdbe883a86bbc7fbf1d1bfc50756e1b42fc45b5 (patch)
tree051a7571c8acaf5451b5c9b7d67f1796a345c565 /lapi.c
parent4d0935ec0ffed827aade5594216fae15bed7c6b5 (diff)
downloadlua-abdbe883a86bbc7fbf1d1bfc50756e1b42fc45b5.tar.gz
lua-abdbe883a86bbc7fbf1d1bfc50756e1b42fc45b5.tar.bz2
lua-abdbe883a86bbc7fbf1d1bfc50756e1b42fc45b5.zip
first implementation of unrestricted static scoping
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lapi.c b/lapi.c
index 7c2f5d52..5c54c60c 100644
--- a/lapi.c
+++ b/lapi.c
@@ -248,7 +248,7 @@ LUA_API size_t lua_strlen (lua_State *L, int index) {
248 248
249LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) { 249LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index) {
250 StkId o = luaA_indexAcceptable(L, index); 250 StkId o = luaA_indexAcceptable(L, index);
251 return (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->f.c; 251 return (o == NULL || !iscfunction(o)) ? NULL : clvalue(o)->u.c.f;
252} 252}
253 253
254 254
@@ -310,9 +310,16 @@ LUA_API void lua_pushstring (lua_State *L, const l_char *s) {
310 310
311 311
312LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { 312LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
313 Closure *cl;
313 lua_lock(L); 314 lua_lock(L);
314 api_checknelems(L, n); 315 api_checknelems(L, n);
315 luaV_Cclosure(L, fn, n); 316 cl = luaF_newCclosure(L, n);
317 cl->u.c.f = fn;
318 L->top -= n;
319 while (n--)
320 setobj(&cl->u.c.upvalue[n], L->top+n);
321 setclvalue(L->top, cl);
322 incr_top;
316 lua_unlock(L); 323 lua_unlock(L);
317} 324}
318 325