Skip to content

Fix: Bug with marshalling lua_Debug #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Lua54.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public static class Lua
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct lua_Debug {
public int _event;
public string name;
public string namewhat;
public string what;
public string source;
public size_t srclen;
public nint name;
public nint namewhat;
public nint what;
public nint source;
public nint srclen;
public int currentline;
public int linedefined;
public int lastlinedefined;
Expand Down Expand Up @@ -447,7 +447,7 @@ public static void lua_call(lua_State L, int n, int r)

[DllImport(DllName, CallingConvention = Convention, EntryPoint = "lua_pcallk")]
private static extern int _lua_pcallk(lua_State L, int nargs, int nresults, int errfunc, nint ctx, nint k);
public static int lua_pcallk(lua_State L, int nargs, int nresults, int errfunc, lua_KContext? ctx, lua_KFunction? k)
public static unsafe int lua_pcallk(lua_State L, int nargs, int nresults, int errfunc, lua_KContext? ctx, lua_KFunction? k)
{
return _lua_pcallk(L, nargs, nresults, errfunc, ctx == null ? 0 : ctx.Value.Handle, k == null ? 0 : Marshal.GetFunctionPointerForDelegate(k));
}
Expand Down Expand Up @@ -730,7 +730,7 @@ public static int lua_setuservalue(lua_State L, int idx)

[DllImport(DllName, CallingConvention = Convention, EntryPoint = "lua_sethook")]
private static extern void _lua_sethook(lua_State L, nint func, int mask, int count);
public static void lua_sethook(lua_State L, lua_Hook? func, int mask, int count)
public static void lua_sethook(lua_State L, lua_Hook func, int mask, int count)
{
_lua_sethook(L, func == null ? 0 : Marshal.GetFunctionPointerForDelegate(func), mask, count);
}
Expand Down