protected override void OnDisposeUnmangedResources()
{
base.OnDisposeUnmangedResources();
Application.Invoke(() =>
{
if (_luaState == IntPtr.Zero) return;
const int luaRegistryIndex = (int)LuaInnerIndex.LUA_REGISTRYINDEX;
Lua.luaL_unref(_luaState, luaRegistryIndex, _luaFunctionRefIndex);
_luaState = IntPtr.Zero;
_luaFunctionRefIndex = 0;
});
}