lua_pushvalue:Pushes a copy of the element at the given valid index onto the stack ,也就是说复制指定索引的值到栈顶,指定索引的值不变,影响栈大小。 lua_remove:Removes the element at the given valid index, shifting down the elements
lua_pushvalue# [-0, +1, –] void lua_pushvalue (lua_State *L, int index); 把栈上给定索引处的元素作一个副本压栈。 lua_pushvfstring# [-0, +1, e] const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp); 等价于 lua_pushfstring, 不过是用 va_list 接收参数...
lua_pushvalue(L, lua_upvalueindex(i+1));return2;caseLUA_TSTRING:/*as length operator*/if(*lua_tostring(L,1) =='#') { lua_pushinteger(L, n);return1; }break;caseLUA_TNONE:/*get all varargs*/luaL_checkstack(L, n,"too many values");for(i =1; i <= n; ++i) lua_pushvalue...
void lua_pushvalue (lua_State *L, int index); Pushes a copy of the element at the given valid index onto the stack 如上所述, lua_pushvalue(L, -4) 并不是往栈顶插入元素-4, 而是把在栈中位置为-4的元素copy之后插入于栈顶中!!!
lua_pushvalue(L, -1); /* duplicate it */ lua_replace(L, lua_upvalueindex(1)); return 1; } lua_upvaluesindex(1) ,就是取出upvalues值,其索引为第一个参数。 由于这个参数并不是堆栈中索引,而是仅仅表示参数序位的索引,即,取出 upvalue的当前值。
lua_pushvalue(L, 1); // 将异常处理函数 errfunc 写入调用栈 lua_rotate(L, 3, 2); /* move them below function's arguments */ status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); return finishpcall(L, status, 2); ...
lua_pushvalue void lua_pushvalue (lua_State *L, int index); 把堆栈上给定有效处索引处的元素作一个拷贝压栈。 lua_pushvfstring const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp); 等价于lua_pushfstring,不过是用va_list接收参数,而不是用可变数量的实际参数。
// 创建一个协程对象 static int luaB_cocreate (lua_State *L) { lua_State *NL; // 第一个参数一定是一个函数对象 luaL_checktype(L, 1, LUA_TFUNCTION); // 新建线程 NL = lua_newthread(L); lua_pushvalue(L, 1); /* move function to top */ // 将函数对象转移到NL lua_xmove(L, NL...
void lua_pushvalue(lua_State *L, int index); // 用于将栈顶的值弹出,并将其设置为lua的全局变量 void lua_setglobal(lua_State *L, const char *name); // 用于将lua全局变量的值推入堆栈 void lua_getglobal(lua_State *L, const char *name); // 用于将栈顶的值弹出,并将其设置为index处的...
LuaDLL.lua_pushvalue返回transform,后面做些收尾 LuaDLL.lua_rawseti LuaDLL.lua_remove 第二步: TransformWrap.set_positionlua想把pos设置到transform.position LuaDLL.luanet_rawnetobj把lua中的transform变成c#可以辨认的id ObjectTranslator.TryGetValue用这个id,从ObjectTranslator中获取c#的transform对象 ...