Skip to content

Commit 8870e96

Browse files
committed
Fix #2 luaL_checkoption parameter is incorrect
1 parent d365692 commit 8870e96

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,3 +453,9 @@ $RECYCLE.BIN/
453453
!.vscode/tasks.json
454454
!.vscode/launch.json
455455
!.vscode/extensions.json
456+
457+
##
458+
## Local testing
459+
##
460+
lua-all
461+
luajit

main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <stdio.h>
2+
3+
int main(int argc, char** argv)
4+
{
5+
printf("%llu\n", sizeof(int));
6+
return 0;
7+
}

src/Lua51.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,8 @@ public static void luaL_setn(lua_State L, int i, int j)
609609
[DllImport(DllName, CallingConvention = Convention)]
610610
public static extern int luaL_error(lua_State L, string fmt, params string[] args);
611611

612-
// TODO: I dont think string[][] works
613612
[DllImport(DllName, CallingConvention = Convention)]
614-
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[][] lst);
613+
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[] lst);
615614

616615
[DllImport(DllName, CallingConvention = Convention)]
617616
public static extern int luaL_ref(lua_State L, int t);

src/Lua52.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,8 @@ public static void luaL_checkversion(lua_State L)
715715
[DllImport(DllName, CallingConvention = Convention)]
716716
public static extern int luaL_error(lua_State L, string fmt, params string[] args);
717717

718-
// TODO: I dont think string[][] works
719718
[DllImport(DllName, CallingConvention = Convention)]
720-
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[][] lst);
719+
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[] lst);
721720

722721
[DllImport(DllName, CallingConvention = Convention)]
723722
public static extern int luaL_fileresult(lua_State L, int stat, string fname);

src/Lua53.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,8 @@ public static void luaL_checkversion(lua_State L)
728728
[DllImport(DllName, CallingConvention = Convention)]
729729
public static extern int luaL_error(lua_State L, string fmt, params string[] args);
730730

731-
// TODO: I dont think string[][] works
732731
[DllImport(DllName, CallingConvention = Convention)]
733-
public static extern int luaL_checkoption(lua_State L, int arg, string def, string[][] lst);
732+
public static extern int luaL_checkoption(lua_State L, int arg, string def, string[] lst);
734733

735734
[DllImport(DllName, CallingConvention = Convention)]
736735
public static extern int luaL_fileresult(lua_State L, int stat, string fname);

src/Lua54.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace Lua54;
22

33
using System;
4-
using System.Diagnostics;
54
using System.Runtime.InteropServices;
65

76
using voidp = System.UIntPtr;
@@ -765,9 +764,8 @@ public static void luaL_checkversion(lua_State L)
765764
[DllImport(DllName, CallingConvention = Convention)]
766765
public static extern int luaL_error(lua_State L, string fmt, params string[] args);
767766

768-
// TODO: I dont think string[][] works
769767
[DllImport(DllName, CallingConvention = Convention)]
770-
public static extern int luaL_checkoption(lua_State L, int arg, string def, string[][] lst);
768+
public static extern int luaL_checkoption(lua_State L, int arg, string def, string[] lst);
771769

772770
[DllImport(DllName, CallingConvention = Convention)]
773771
public static extern int luaL_fileresult(lua_State L, int stat, string fname);

src/LuaJIT.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,8 @@ public static double lua_version(lua_State L)
660660
[DllImport(DllName, CallingConvention = Convention)]
661661
public static extern int luaL_error(lua_State L, string fmt, params string[] args);
662662

663-
// TODO: I dont think string[][] works
664663
[DllImport(DllName, CallingConvention = Convention)]
665-
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[][] lst);
664+
public static extern int luaL_checkoption(lua_State L, int narg, string def, string[] lst);
666665

667666
public const int LUA_NOREF = -2;
668667
public const int LUA_REFNIL = -1;

0 commit comments

Comments
 (0)