示例#1
0
        public LuaLibrary(LVM vm)
        {
            this.vm         = vm;
            stackFrame      = vm.stackFrame;
            Add(traceFunc   = new LuaNative(vm, "trace", Trace));
            Add(printFunc   = new LuaNative(vm, "print", Print));
            Add(lenFunc     = new LuaNative(vm, "len", Length));
            Add(pairsFunc   = new LuaNative(vm, "pairs", Pairs));
            Add(nextFunc    = new LuaNative(vm, "next", Next));
            Add(ipairsFunc  = new LuaNative(vm, "ipairs", IPairs));
            Add(iterFunc    = new LuaNative(vm, vm.NewUID(), Iterator));
            Add(setmetaFunc = new LuaNative(vm, "setmetatable", SetMetatable));
            Add(getmetaFunc = new LuaNative(vm, "getmetatable", GetMetatable));

            Add("table", table = vm.GetTable());
            table.Bind(vm.GetString("insert"), new LuaNative(vm, "insert", Insert));
        }
示例#2
0
 public void Add(LuaNative native)
 {
     stackFrame.Bind(native.name, native);
 }