Exemple #1
0
    public LuaTable getLuaTable(string name)
    {
        LuaTable tb;

        if (!luaTableDic.TryGetValue(name, out tb))
        {
            tb = LuaLoader.GetMainState().GetTable(name);

            if (tb == null)
            {
                Debugger.LogError("get lua table error,name==" + name);
            }

            luaTableDic.Add(name, tb);
        }

        LuaFunction constructFunction = tb.GetLuaFunction("new");

        if (constructFunction == null)
        {
            Debugger.LogError("there is no contruct function in luaTable==" + name);
            return(null);
        }

        LuaTable ret;

        object[] rets = constructFunction.Call(tb);
        ret = (LuaTable)rets[0];

        constructFunction.Dispose();
        constructFunction = null;

        return(ret);
    }
    public LuaTable getTblData(string tablename, int idx)
    {
        LuaTable tableData = LuaLoader.GetMainState().GetTable(tablename);

        LuaTable ret = tableData[idx] as LuaTable;

        return(ret);
    }