本文整理汇总了C#中KopiLua.Lua.LuaTypeValue类的典型用法代码示例。如果您正苦于以下问题:C# Lua.LuaTypeValue类的具体用法?C# Lua.LuaTypeValue怎么用?C# Lua.LuaTypeValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lua.LuaTypeValue类属于KopiLua命名空间,在下文中一共展示了Lua.LuaTypeValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LuaGArithError
public static void LuaGArithError(LuaState L, TValue p1, TValue p2)
{
TValue temp = new LuaTypeValue();
if (luaV_tonumber(p1, temp) == null)
p2 = p1; /* first operand is wrong */
LuaGTypeError(L, p2, "perform arithmetic on");
}
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:7,代码来源:ldebug.cs
示例2: Arith
public static void Arith(LuaState L, StkId ra, TValue rb,
TValue rc, TMS op)
{
TValue tempb = new LuaTypeValue(), tempc = new LuaTypeValue();
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: LuaAssert(false); break;
}
}
else if (call_binTM(L, rb, rc, ra, op) == 0)
LuaGArithError(L, rb, rc);
}
开发者ID:WondermSwift,项目名称:KopiLua,代码行数:22,代码来源:lvm.cs
示例3: LuaFindUpVal
public static UpVal LuaFindUpVal(LuaState L, StkId level)
{
GlobalState g = G(L);
GCObjectRef pp = new OpenValRef(L);
UpVal p;
UpVal uv;
while (pp.get() != null && (p = ngcotouv(pp.get())).v >= level)
{
LuaAssert(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 = LuaMNew<UpVal>(L); /* not found: create a new one */
uv.tt = LUATUPVAL;
uv.marked = LuaCWhite(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;
LuaAssert(uv.u.l.next.u.l.prev == uv && uv.u.l.prev.u.l.next == uv);
return uv;
}
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:30,代码来源:lfunc.cs
示例4: LuaFClose
public static void LuaFClose(LuaState L, StkId level)
{
UpVal uv;
GlobalState g = G(L);
while (L.openupval != null && (uv = ngcotouv(L.openupval)).v >= level) {
GCObject o = obj2gco(uv);
LuaAssert(!IsBlack(o) && uv.v != uv.u.value);
L.openupval = uv.next; /* remove from `open' list */
if (IsDead(g, o))
LuaFreeUpVal(L, uv); /* free upvalue */
else {
UnlinkUpVal(uv);
SetObj(L, uv.u.value, uv.v);
uv.v = uv.u.value; /* now current value lives here */
LuaCLinkUpVal(L, uv); /* link upvalue into `gcroot' list */
}
}
}
开发者ID:GSharpDevs,项目名称:RunG,代码行数:18,代码来源:lfunc.cs
示例5: arith_op
public static void arith_op(LuaState 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:WondermSwift,项目名称:KopiLua,代码行数:18,代码来源:lvm.cs
示例6: luaT_gettmbyobj
public static TValue luaT_gettmbyobj(LuaState L, TValue o, TMS event_)
{
Table mt;
switch (TType(o))
{
case LUA_TTABLE:
mt = HValue(o).metatable;
break;
case LUA_TUSERDATA:
mt = UValue(o).metatable;
break;
default:
mt = G(L).mt[TType(o)];
break;
}
return ((mt != null) ? luaH_getstr(mt, G(L).tmname[(int)event_]) : LuaONilObject);
}
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:20,代码来源:ltm.cs
示例7: luaH_get
/*
** main search function
*/
public static TValue luaH_get(Table t, TValue key)
{
switch (TType(key))
{
case LUA_TNIL: return LuaONilObject;
case LUA_TSTRING: return luaH_getstr(t, RawTSValue(key));
case LUA_TNUMBER:
{
int k;
lua_Number n = NValue(key);
lua_number2int(out k, n);
if (luai_numeq(CastNum(k), NValue(key))) /* index is int? */
return luaH_getnum(t, k); /* use specialized version */
/* else go through ... actually on second thoughts don't, because this is C#*/
Node node = mainposition(t, key);
do
{ /* check whether `key' is somewhere in the chain */
if (LuaORawEqualObj(key2tval(node), key) != 0)
return gval(node); /* that's it */
else node = gnext(node);
} while (node != null);
return LuaONilObject;
}
default:
{
Node node = mainposition(t, key);
do
{ /* check whether `key' is somewhere in the chain */
if (LuaORawEqualObj(key2tval(node), key) != 0)
return gval(node); /* that's it */
else node = gnext(node);
} while (node != null);
return LuaONilObject;
}
}
}
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:39,代码来源:ltable.cs
示例8: 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:prabirshrestha,项目名称:KopiLua,代码行数:7,代码来源:lobject.cs
示例9: TTIsThread
internal static bool TTIsThread(TValue o)
{
return (TType(o) == LUA_TTHREAD);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例10: TTIsString
internal static bool TTIsString(TValue o)
{
return (TType(o) == LUA_TSTRING);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例11: TTIsNil
/* Macros to test type */
internal static bool TTIsNil(TValue o)
{
return (TType(o) == LUA_TNIL);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:5,代码来源:lobject.cs
示例12: TTIsBoolean
internal static bool TTIsBoolean(TValue o)
{
return (TType(o) == LUA_TBOOLEAN);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例13: SetNValue
internal static void SetNValue(TValue obj, LuaNumberType x)
{
obj.value.n = x;
obj.tt = LUA_TNUMBER;
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:5,代码来源:lobject.cs
示例14: SetNilValue
/* Macros to set values */
internal static void SetNilValue(TValue obj)
{
obj.tt=LUA_TNIL;
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:5,代码来源:lobject.cs
示例15: SetTType
internal static void SetTType(TValue obj, int tt)
{
obj.tt = tt;
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例16: SetUValue
internal static void SetUValue(LuaState L, TValue obj, GCObject x)
{
obj.value.gc = x;
obj.tt = LUA_TUSERDATA;
CheckLiveness(G(L), obj);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:6,代码来源:lobject.cs
示例17: SetObj
internal static void SetObj(LuaState L, TValue obj1, TValue obj2)
{
obj1.value.Copy(obj2.value);
obj1.tt = obj2.tt;
CheckLiveness(G(L), obj1);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:6,代码来源:lobject.cs
示例18: TTIsFunction
internal static bool TTIsFunction(TValue o)
{
return (TType(o) == LUA_TFUNCTION);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例19: TTIsNumber
internal static bool TTIsNumber(TValue o)
{
return (TType(o) == LUA_TNUMBER);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:lobject.cs
示例20: SetPTValue
internal static void SetPTValue(LuaState L, TValue obj, Proto x)
{
obj.value.gc = x;
obj.tt = LUATPROTO;
CheckLiveness(G(L), obj);
}
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:6,代码来源:lobject.cs
注:本文中的KopiLua.Lua.LuaTypeValue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论