/// <summary> /// Initializes a new instance of the <see cref="Lua"/> class. /// </summary> public Lua() { MainState = LuaApi.NewState(); LuaApi.OpenLibs(MainState); // To clean references, we set a hook that executes after a certain number of instructions have been executed. _cleanReferencesDelegate = CleanReferences; LuaApi.SetHook(MainState, _cleanReferencesDelegate, LuaHookMask.Count, CleanReferencesPeriod); _binder = new ObjectBinder(this); this["using"] = CreateFunction(new Action <string>(ImportNamespace)); }