internal void push(IntPtr l, object o, bool checkReflect, bool isArray = false) { if (o == null) { LuaDLL.lua_pushnil(l); return; } int index = -1; bool gco = isGcObject(o); bool found = gco && objMap.TryGetValue(o, out index); if (found) { if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1) { return; } } index = add(o); #if SLUA_CHECK_REFLECTION int isReflect = LuaDLL.luaS_pushobject(l, index, isArray ? "LuaArray" : getAQName(o), gco, udCacheRef); if (isReflect != 0 && checkReflect && !isArray) { Logger.LogWarning(string.Format("{0} not exported, using reflection instead", o.ToString())); } #else LuaDLL.luaS_pushobject(l, index, isArray?"LuaArray":getAQName(o), gco, udCacheRef); #endif }
public static string GetLuaAddr(IntPtr l, int objIndex, int cref) { string luaAddr = string.Empty; if (LuaDLL.luaS_getcacheud(l, objIndex, cref) == 1) { IntPtr p = LuaDLL.lua_topointer(l, -1); LuaDLL.lua_pop(l, 1); luaAddr = string.Format("{0:x8}", p.ToInt64()); } return(luaAddr); }
/// <summary> /// push o to cache list /// </summary> /// <param name="l"></param> /// <param name="o"></param> /// <returns></returns> internal int allocID(IntPtr l,object o) { int index = -1; if (o == null) { LuaDLL.lua_pushnil(l); return index; } bool gco = isGcObject(o); bool found = gco && objMap.TryGetValue(o, out index); if (found) { //already found, do not need to add again if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1) return -1; } index = add(o); return index; }
internal int allocID(IntPtr l, object o) { int index = -1; if (o == null) { LuaDLL.lua_pushnil(l); return(index); } bool gco = isGcObject(o); bool found = gco && objMap.TryGetValue(o, out index); if (found) { if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1) { return(-1); } } index = add(o); return(index); }
internal void push(IntPtr l, object o) { if (o == null) { LuaDLL.lua_pushnil(l); return; } int index = -1; bool gco = isGcObject(o); bool found = gco && objMap.TryGetValue(o, out index); if (found) { if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1) { return; } } index = add(o); LuaDLL.luaS_pushobject(l, index, getAQName(o), gco, udCacheRef); }