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)); }
public void Add(LuaNative native) { stackFrame.Bind(native.name, native); }