private static int tostring_T(Lua.lua_State L) { byte[] d = (byte[])Lua.lua_touserdata(L, 1); if (d == null) { Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, 1, LunaTraits_LWF_Point.className); } Luna.userdataType ud = new Luna.userdataType(d); LWF.Point obj = null; if (!objects[L].TryGetValue(ud.ObjectId, out obj)) { return(0); } char[] buff = obj.ToString().ToCharArray(0, 32); Lua.lua_pushfstring(L, "%s (%s)", new object[] { LunaTraits_LWF_Point.className, buff }); return(1); }
static public LWF.Point check(Lua.lua_State L, int narg) { byte[] d = (byte[])Lua.lua_touserdata(L, narg); if (d == null) { Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, narg, LunaTraits_LWF_Point.className); } Luna.userdataType ud = new Luna.userdataType(d); if (ud.TypeId != LunaTraits_LWF_Point.uniqueID) // type checking with almost no overhead { Luna.print(String.Format("ud.uid: {0} != interface::uid : {1}\n", ud.TypeId, LunaTraits_LWF_Point.uniqueID)); Lua.luaL_typerror(L, narg, LunaTraits_LWF_Point.className); } LWF.Point obj = null; if (!objects[L].TryGetValue(ud.ObjectId, out obj)) { return(null); } return(obj); }
// garbage collection metamethod private static int gc_T(Lua.lua_State L) { byte[] d = (byte[])Lua.lua_touserdata(L, 1); if (d == null) { Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, 1, LunaTraits_LWF_Point.className); } Luna.userdataType ud = new Luna.userdataType(d); LWF.Point obj = null; if (!objects[L].TryGetValue(ud.ObjectId, out obj)) { return(0); } if (ud.Gc) { LunaTraits_LWF_Point._bind_dtor(obj); // call constructor for T objects Destroy(L, obj); } return(0); }
public static LWF.Point _bind_ctor(Lua.lua_State L) { Luna.print("undefined contructor of LWF.Point called\n"); return(null); }