Esempio n. 1
0
    public void Register()
    {
        LuaMethod[] metas = new LuaMethod[]
        {
            new LuaMethod("__index", Lua_Index),
            new LuaMethod("__newindex", Lua_NewIndex),
        };

        luaMgr    = LuaScriptMgr.Instance;
        reference = luaMgr.RegisterLib("GameObject", regs);
        luaMgr.CreateMetaTable("GameObject", metas, typeof(GameObject));
        luaMgr.RegisterField(typeof(GameObject), fields);
    }
Esempio n. 2
0
    static int CreateMetaTable(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 4);
        IntPtr arg0 = (IntPtr)LuaScriptMgr.GetNumber(L, 1);
        string arg1 = LuaScriptMgr.GetLuaString(L, 2);

        LuaMethod[] objs2 = LuaScriptMgr.GetArrayObject <LuaMethod>(L, 3);
        Type        arg3  = LuaScriptMgr.GetTypeObject(L, 4);
        int         o     = LuaScriptMgr.CreateMetaTable(arg0, arg1, objs2, arg3);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Esempio n. 3
0
    public void Register()
    {
        LuaMethod[] metas = new LuaMethod[]
        {
            new LuaMethod("__index", Lua_Index),
            new LuaMethod("__newindex", Lua_NewIndex),
            new LuaMethod("__tostring", Lua_ToString),
            new LuaMethod("__add", Lua_Add),
            new LuaMethod("__sub", Lua_Sub),
            new LuaMethod("__mul", Lua_Mul),
            new LuaMethod("__div", Lua_Div),
            new LuaMethod("__eq", Lua_Eq),
            new LuaMethod("__unm", Lua_Neg),
        };

        luaMgr    = LuaScriptMgr.Instance;
        reference = luaMgr.RegisterLib("Vector2", regs);
        luaMgr.CreateMetaTable("Vector2", metas, typeof(Vector2));
        luaMgr.RegisterField(typeof(Vector2), fields);
    }