Closed
Description
I'm getting "System.AccessViolationException: Attempted to read or write protected memory" when trying to use the Debug library hooks.
I've tried with all the Lua versions and none of them seem to work, here's a snippet of code that will help reproduce the issue.
using LuaNET.Lua54;
using NativeMethods = LuaNET.Lua54.Lua;
var lua = NativeMethods.luaL_newstate();
NativeMethods.luaL_openlibs(lua);
NativeMethods.lua_sethook(lua, Hook, NativeMethods.LUA_MASKLINE, 0);
NativeMethods.luaL_dostring(lua, "print(10)\nprint(20)\nlocal x = 10");
return;
static void Hook(lua_State state, NativeMethods.lua_Debug func)
{
Console.WriteLine("Test");
}
The function signature in lua.h does seem to match the bindings, so not sure what could be wrong here.
Metadata
Metadata
Assignees
Labels
No labels