aboutsummaryrefslogtreecommitdiff
path: root/lfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'lfunc.h')
-rw-r--r--lfunc.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/lfunc.h b/lfunc.h
index c5e8b89c..39dbc901 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.h,v 2.8 2012/05/08 13:53:33 roberto Exp roberto $ 2** $Id: lfunc.h,v 2.9 2013/08/07 12:18:11 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -18,10 +18,28 @@
18 cast(int, sizeof(TValue *)*((n)-1))) 18 cast(int, sizeof(TValue *)*((n)-1)))
19 19
20 20
21/*
22** Upvalues for Lua closures
23*/
24struct UpVal {
25 TValue *v; /* points to stack or to its own value */
26 unsigned int refcount; /* reference counter */
27 union {
28 struct { /* (when open) */
29 UpVal *next; /* linked list */
30 int touched; /* mark to avoid cycles with dead threads */
31 } op;
32 TValue value; /* the value (when closed) */
33 } u;
34};
35
36#define upisopen(up) ((up)->v != &(up)->u.value)
37
38
21LUAI_FUNC Proto *luaF_newproto (lua_State *L); 39LUAI_FUNC Proto *luaF_newproto (lua_State *L);
22LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems); 40LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems);
23LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems); 41LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems);
24LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 42LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
25LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 43LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
26LUAI_FUNC void luaF_close (lua_State *L, StkId level); 44LUAI_FUNC void luaF_close (lua_State *L, StkId level);
27LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 45LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);