本文整理汇总了C++中setobj2n函数的典型用法代码示例。如果您正苦于以下问题:C++ setobj2n函数的具体用法?C++ setobj2n怎么用?C++ setobj2n使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setobj2n函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mallocstate
lua_State *luaE_newthread (lua_State *L) {
lua_State *L1 = mallocstate(L);
luaC_link(L, valtogco(L1), LUA_TTHREAD);
preinit_state(L1);
L1->l_G = L->l_G;
stack_init(L1, L); /* init stack */
setobj2n(gt(L1), gt(L)); /* share table of globals */
return L1;
}
示例2: luaF_close
void luaF_close (lua_State *L, StkId level) {
UpVal *p;
while ((p = ngcotouv(L->openupval)) != NULL && p->v >= level) {
setobj2n(&p->value, p->v); /* save current value (write barrier) */
p->v = &p->value; /* now current value lives here */
L->openupval = p->next; /* remove from `open' list */
luaC_link(L, valtogco(p), LUA_TUPVAL);
}
}
示例3: tostate
lua_State *luaE_newthread (lua_State *L) {
lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
luaC_link(L, obj2gco(L1), LUA_TTHREAD);
preinit_state(L1, G(L));
stack_init(L1, L); /* init stack */
setobj2n(L, gt(L1), gt(L)); /* share table of globals */
L1->hookmask = L->hookmask;
L1->basehookcount = L->basehookcount;
L1->hook = L->hook;
resethookcount(L1);
lua_assert(iswhite(obj2gco(L1)));
return L1;
}
示例4: lua_pushcclosure
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
Closure *cl;
lua_lock(L);
luaC_checkGC(L);
api_checknelems(L, n);
cl = luaF_newCclosure(L, n);
cl->c.f = fn;
L->top -= n;
while (n--)
setobj2n(&cl->c.upvalue[n], L->top+n);
setclvalue(L->top, cl);
api_incr_top(L);
lua_unlock(L);
}
示例5: tostate
lua_State *luaE_newthread (lua_State *L) {
lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
luaC_link(L, obj2gco(L1), LUA_TTHREAD);
setthvalue(L, L->top, L1); /* put thread on stack */
incr_top(L);
preinit_state(L1, G(L));
stack_init(L1, L); /* init stack */
setobj2n(L, gt(L1), gt(L)); /* share table of globals */
L1->hookmask = L->hookmask;
L1->basehookcount = L->basehookcount;
L1->hook = L->hook;
resethookcount(L1);
lua_assert(!isdead(G(L), obj2gco(L1)));
L->top--; /* remove thread from stack */
return L1;
}
示例6: lua_pushcclosure
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
lua_lock(L);
if (n == 0) {
setfvalue(L->top, fn);
}
else {
Closure *cl;
api_checknelems(L, n);
api_check(L, n <= MAXUPVAL, "upvalue index too large");
luaC_checkGC(L);
cl = luaF_newCclosure(L, n);
cl->c.f = fn;
L->top -= n;
while (n--)
setobj2n(L, &cl->c.upvalue[n], L->top + n);
setclCvalue(L, L->top, cl);
}
api_incr_top(L);
lua_unlock(L);
}
示例7: mallocstate
lua_State *luaE_newthread (lua_State *L) {
lua_State *L1 = mallocstate(L);
luaC_link(L, valtogco(L1), LUA_TTHREAD);
preinit_state(L1);
L1->l_G = L->l_G;
#if LUA_REFCOUNT
L1->gclist_head.next = (GCObject*)&L->gclist_tail;
L1->gclist_head.prev = NULL;
L1->gclist_tail.next = NULL;
L1->gclist_tail.prev = (GCObject*)&L->gclist_head;
L1->gclist_head.tt = LUA_TNIL;
L1->gclist_head.marked = 0;
L1->gclist_head.ref = 0;
L1->gclist_tail.tt = LUA_TNIL;
L1->gclist_tail.marked = 0;
L1->gclist_tail.ref = 0;
L1->ref = 0;
#endif LUA_REFCOUNT
stack_init(L1, L); /* init stack */
setobj2n(gt(L1), gt(L)); /* share table of globals */
return L1;
}