当前位置: 首页>>代码示例>>C#>>正文


C# Lua.lua_TValue类代码示例

本文整理汇总了C#中KopiLua.Lua.lua_TValue的典型用法代码示例。如果您正苦于以下问题:C# Lua.lua_TValue类的具体用法?C# Lua.lua_TValue怎么用?C# Lua.lua_TValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Lua.lua_TValue类属于KopiLua命名空间,在下文中一共展示了Lua.lua_TValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: luaF_findupval

 public static UpVal luaF_findupval(lua_State L, StkId level)
 {
     global_State g = G(L);
       GCObjectRef pp = new OpenValRef(L);
       UpVal p;
       UpVal uv;
       while (pp.get() != null && (p = ngcotouv(pp.get())).v >= level) {
     lua_assert(p.v != p.u.value);
     if (p.v == level) {  /* found a corresponding upvalue? */
       if (isdead(g, obj2gco(p)))  /* is it dead? */
         changewhite(obj2gco(p));  /* ressurect it */
       return p;
     }
     pp = new NextRef(p);
       }
       uv = luaM_new<UpVal>(L);  /* not found: create a new one */
       uv.tt = LUA_TUPVAL;
       uv.marked = luaC_white(g);
       uv.v = level;  /* current value lives in the stack */
       uv.next = pp.get();  /* chain it in the proper position */
       pp.set( obj2gco(uv) );
       uv.u.l.prev = g.uvhead;  /* double link it in `uvhead' list */
       uv.u.l.next = g.uvhead.u.l.next;
       uv.u.l.next.u.l.prev = uv;
       g.uvhead.u.l.next = uv;
       lua_assert(uv.u.l.next.u.l.prev == uv && uv.u.l.prev.u.l.next == uv);
       return uv;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:28,代码来源:lfunc.cs

示例2: luaG_aritherror

 public static void luaG_aritherror(lua_State L, TValue p1, TValue p2)
 {
     TValue temp = new TValue();
       if (luaV_tonumber(p1, temp) == null)
     p2 = p1;  /* first operand is wrong */
       luaG_typeerror(L, p2, "perform arithmetic on");
 }
开发者ID:lenzener,项目名称:LuaInterface,代码行数:7,代码来源:ldebug.cs

示例3: luaF_close

 public static void luaF_close(lua_State L, StkId level)
 {
     UpVal uv;
       global_State g = G(L);
       while (L.openupval != null && (uv = ngcotouv(L.openupval)).v >= level) {
     GCObject o = obj2gco(uv);
     lua_assert(!isblack(o) && uv.v != uv.u.value);
     L.openupval = uv.next;  /* remove from `open' list */
     if (isdead(g, o))
       luaF_freeupval(L, uv);  /* free upvalue */
     else {
       unlinkupval(uv);
       setobj(L, uv.u.value, uv.v);
       uv.v = uv.u.value;  /* now current value lives here */
       luaC_linkupval(L, uv);  /* link upvalue into `gcroot' list */
     }
       }
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:18,代码来源:lfunc.cs

示例4: arith_op

 public static void arith_op(lua_State L, op_delegate op, TMS tm, StkId base_, Instruction i, TValue[] k, StkId ra, InstructionPtr pc)
 {
     TValue rb = RKB(L, base_, i, k);
         TValue rc = RKC(L, base_, i, k);
         if (ttisnumber(rb) && ttisnumber(rc))
         {
             lua_Number nb = nvalue(rb), nc = nvalue(rc);
             setnvalue(ra, op(nb, nc));
         }
         else
         {
             //Protect(
             L.savedpc = InstructionPtr.Assign(pc);
             Arith(L, ra, rb, rc, tm);
             base_ = L.base_;
             //);
         }
 }
开发者ID:lenzener,项目名称:LuaInterface,代码行数:18,代码来源:lvm.cs

示例5: Arith

        public static void Arith(lua_State L, StkId ra, TValue rb,
						   TValue rc, TMS op)
        {
            TValue tempb = new TValue(), tempc = new TValue();
              TValue b, c;
              if ((b = luaV_tonumber(rb, tempb)) != null &&
              (c = luaV_tonumber(rc, tempc)) != null) {
            lua_Number nb = nvalue(b), nc = nvalue(c);
            switch (op) {
              case TMS.TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
              case TMS.TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
              case TMS.TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
              case TMS.TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break;
              case TMS.TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
              case TMS.TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
              case TMS.TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
              default: lua_assert(false); break;
            }
              }
              else if (call_binTM(L, rb, rc, ra, op) == 0)
            luaG_aritherror(L, rb, rc);
        }
开发者ID:lenzener,项目名称:LuaInterface,代码行数:22,代码来源:lvm.cs

示例6: TValue

 public static lua_Integer lua_tointeger(lua_State L, int idx)
 {
     TValue n = new TValue();
       TValue o = index2adr(L, idx);
       if (tonumber(ref o, n) != 0) {
     lua_Integer res;
     lua_Number num = nvalue(o);
     lua_number2integer(out res, num);
     return res;
       }
       else
     return 0;
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:13,代码来源:lapi.cs

示例7: lua_setfield

 public static void lua_setfield(lua_State L, int idx, CharPtr k)
 {
     StkId t;
       TValue key = new TValue();
       lua_lock(L);
       api_checknelems(L, 1);
       t = index2adr(L, idx);
       api_checkvalidindex(L, t);
       setsvalue(L, key, luaS_new(L, k));
       luaV_settable(L, t, key, L.top - 1);
       StkId.dec(ref L.top);  /* pop value */
       lua_unlock(L);
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:13,代码来源:lapi.cs

示例8: api_checkvalidindex

 public static void api_checkvalidindex(lua_State L, StkId i)
 {
     api_check(L, i != luaO_nilobject);
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:4,代码来源:lapi.cs

示例9: lua_getupvalue

 public static CharPtr lua_getupvalue(lua_State L, int funcindex, int n)
 {
     CharPtr name;
       TValue val = new TValue();
       lua_lock(L);
       name = aux_upvalue(index2adr(L, funcindex), n, ref val);
       if (name != null) {
     setobj2s(L, L.top, val);
     api_incr_top(L);
       }
       lua_unlock(L);
       return name;
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:13,代码来源:lapi.cs

示例10: aux_upvalue

 static CharPtr aux_upvalue(StkId fi, int n, ref TValue val)
 {
     Closure f;
       if (!ttisfunction(fi)) return null;
       f = clvalue(fi);
       if (f.c.isC != 0) {
     if (!(1 <= n && n <= f.c.nupvalues)) return null;
     val = f.c.upvalue[n-1];
     return "";
       }
       else {
     Proto p = f.l.p;
     if (!(1 <= n && n <= p.sizeupvalues)) return null;
     val = f.l.upvals[n-1].v;
     return getstr(p.upvalues[n-1]);
       }
 }
开发者ID:rumkex,项目名称:LuaInterface,代码行数:17,代码来源:lapi.cs

示例11: Node

 public Node(TValue i_val, TKey i_key)
 {
     this.values = new Node[] { this };
     this.index = 0;
     this.i_val = i_val;
     this.i_key = i_key;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:7,代码来源:lobject.cs

示例12: ttisboolean

 internal static bool ttisboolean(TValue o)
 {
     return (ttype(o) == LUA_TBOOLEAN);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:4,代码来源:lobject.cs

示例13: setuvalue

 internal static void setuvalue(lua_State L, TValue obj, GCObject x)
 {
     obj.value.gc = x;
     obj.tt = LUA_TUSERDATA;
     checkliveness(G(L), obj);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:6,代码来源:lobject.cs

示例14: setttype

 internal static void setttype(TValue obj, int tt)
 {
     obj.tt = tt;
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:4,代码来源:lobject.cs

示例15: setthvalue

 internal static void setthvalue(lua_State L, TValue obj, GCObject x)
 {
     obj.value.gc = x;
     obj.tt = LUA_TTHREAD;
     checkliveness(G(L), obj);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:6,代码来源:lobject.cs


注:本文中的KopiLua.Lua.lua_TValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。