@@ -72,7 +72,7 @@ public struct luaL_Buffer {
7272 public delegate nuint lua_Alloc ( nuint ud , nuint ptr , size_t osize , size_t nsize ) ;
7373 public delegate void lua_Hook ( lua_State L , lua_Debug ar ) ;
7474
75- public static unsafe luaL_Reg AsLuaLReg ( string name , delegate * unmanaged< lua_State , int > func ) => new luaL_Reg { name = name , func = ( nint ) func } ;
75+ public static unsafe luaL_Reg AsLuaLReg ( string name , delegate * unmanaged< lua_State , int > func ) => new ( ) { name = name , func = ( nint ) func } ;
7676
7777 public const string LUA_LDIR = "!\\ lua\\ " ;
7878 public const string LUA_CDIR = "!\\ " ;
@@ -125,7 +125,7 @@ public static int lua_lessthan(lua_State L, int idx1, int idx2)
125125
126126 public const int LUAI_MAXSTACK = 1000000 ;
127127
128- public const int LUAI_FIRSTPSEUDOIDX = ( - LUAI_MAXSTACK - 1000 ) ;
128+ public const int LUAI_FIRSTPSEUDOIDX = - LUAI_MAXSTACK - 1000 ;
129129
130130 public const int LUAL_BUFFERSIZE = 512 ;
131131
@@ -181,7 +181,7 @@ public static int lua_upvalueindex(int i)
181181 private static extern lua_State _lua_newstate ( nint f , nuint ud ) ;
182182 public static lua_State lua_newstate ( lua_Alloc ? f , nuint ud )
183183 {
184- return _lua_newstate ( f == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_Alloc > ( f ) , ud ) ;
184+ return _lua_newstate ( f == null ? 0 : Marshal . GetFunctionPointerForDelegate ( f ) , ud ) ;
185185 }
186186
187187 [ DllImport ( DllName , CallingConvention = Convention ) ]
@@ -194,16 +194,16 @@ public static lua_State lua_newstate(lua_Alloc? f, nuint ud)
194194 private static extern nint _lua_atpanic ( lua_State L , nint panicf ) ;
195195 public static lua_CFunction ? lua_atpanic ( lua_State L , lua_CFunction ? panicf )
196196 {
197- nint panic = _lua_atpanic ( L , panicf == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_CFunction > ( panicf ) ) ;
198- return panic == ( ( nint ) 0 ) ? null : Marshal . GetDelegateForFunctionPointer < lua_CFunction > ( panic ) ;
197+ nint panic = _lua_atpanic ( L , panicf == null ? 0 : Marshal . GetFunctionPointerForDelegate ( panicf ) ) ;
198+ return panic == 0 ? null : Marshal . GetDelegateForFunctionPointer < lua_CFunction > ( panic ) ;
199199 }
200200
201201 [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_version" ) ]
202202 private static extern nint _lua_version ( lua_State L ) ;
203203 public static double lua_version ( lua_State L )
204204 {
205205 nint mem = _lua_version ( L ) ;
206- if ( mem == ( ( nint ) 0 ) )
206+ if ( mem == 0 )
207207 return 0 ;
208208 byte [ ] arr = new byte [ 8 ] ;
209209 for ( int i = 0 ; i < arr . Length ; i ++ )
@@ -290,7 +290,7 @@ public static double lua_version(lua_State L)
290290 public static lua_CFunction ? lua_tocfunction ( lua_State L , int idx )
291291 {
292292 nint ret = _lua_tocfunction ( L , idx ) ;
293- return ret == ( ( nint ) 0 ) ? null : Marshal . GetDelegateForFunctionPointer < lua_CFunction > ( ret ) ;
293+ return ret == 0 ? null : Marshal . GetDelegateForFunctionPointer < lua_CFunction > ( ret ) ;
294294 }
295295
296296 [ DllImport ( DllName , CallingConvention = Convention ) ]
@@ -365,7 +365,7 @@ public static double lua_version(lua_State L)
365365 private static extern void _lua_pushcclosure ( lua_State L , nint fn , int n ) ;
366366 public static void lua_pushcclosure ( lua_State L , lua_CFunction ? fn , int n )
367367 {
368- _lua_pushcclosure ( L , fn == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate ( fn ) , n ) ;
368+ _lua_pushcclosure ( L , fn == null ? 0 : Marshal . GetFunctionPointerForDelegate ( fn ) , n ) ;
369369 }
370370
371371 [ DllImport ( DllName , CallingConvention = Convention ) ]
@@ -435,7 +435,7 @@ public static void lua_pushcclosure(lua_State L, lua_CFunction? fn, int n)
435435 private static extern void _lua_callk ( lua_State L , int nargs , int nresults , int ctx , nint k ) ;
436436 public static void lua_callk ( lua_State L , int nargs , int nresults , int ctx , lua_CFunction ? k )
437437 {
438- _lua_callk ( L , nargs , nresults , ctx , k == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_CFunction > ( k ) ) ;
438+ _lua_callk ( L , nargs , nresults , ctx , k == null ? 0 : Marshal . GetFunctionPointerForDelegate ( k ) ) ;
439439 }
440440
441441 public static void lua_call ( lua_State L , int n , int r )
@@ -450,7 +450,7 @@ public static void lua_call(lua_State L, int n, int r)
450450 private static extern int _lua_pcallk ( lua_State L , int nargs , int nresults , int errfunc , int ctx , nint k ) ;
451451 public static int lua_pcallk ( lua_State L , int nargs , int nresults , int errfunc , int ctx , lua_CFunction ? k )
452452 {
453- return _lua_pcallk ( L , nargs , nresults , errfunc , ctx , k == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_CFunction > ( k ) ) ;
453+ return _lua_pcallk ( L , nargs , nresults , errfunc , ctx , k == null ? 0 : Marshal . GetFunctionPointerForDelegate ( k ) ) ;
454454 }
455455
456456 public static int lua_pcall ( lua_State L , int n , int r , int f )
@@ -462,21 +462,21 @@ public static int lua_pcall(lua_State L, int n, int r, int f)
462462 private static extern int _lua_load ( lua_State L , nint reader , nuint dt , string chunkname , string ? mode ) ;
463463 public static int lua_load ( lua_State L , lua_Reader ? reader , nuint dt , string chunkname , string ? mode )
464464 {
465- return _lua_load ( L , reader == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_Reader > ( reader ) , dt , chunkname , mode ) ;
465+ return _lua_load ( L , reader == null ? 0 : Marshal . GetFunctionPointerForDelegate ( reader ) , dt , chunkname , mode ) ;
466466 }
467467
468468 [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_dump" ) ]
469469 private static extern int _lua_dump ( lua_State L , nint writer , nuint data ) ;
470470 public static int lua_dump ( lua_State L , lua_Writer ? writer , nuint data )
471471 {
472- return _lua_dump ( L , writer == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_Writer > ( writer ) , data ) ;
472+ return _lua_dump ( L , writer == null ? 0 : Marshal . GetFunctionPointerForDelegate ( writer ) , data ) ;
473473 }
474474
475475 [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_yieldk" ) ]
476476 private static extern int _lua_yieldk ( lua_State L , int nresults , int ctx , nint k ) ;
477477 public static int lua_yieldk ( lua_State L , int nresults , int ctx , lua_CFunction ? k )
478478 {
479- return _lua_yieldk ( L , nresults , ctx , k == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_CFunction > ( k ) ) ;
479+ return _lua_yieldk ( L , nresults , ctx , k == null ? 0 : Marshal . GetFunctionPointerForDelegate ( k ) ) ;
480480 }
481481
482482 public static int lua_yield ( lua_State L , int n )
@@ -525,7 +525,7 @@ public static int lua_yield(lua_State L, int n)
525525 private static extern void _lua_setallocf ( lua_State L , nint f , nuint ud ) ;
526526 public static void lua_setallocf ( lua_State L , lua_Alloc ? f , nuint ud )
527527 {
528- _lua_setallocf ( L , f == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_Alloc > ( f ) , ud ) ;
528+ _lua_setallocf ( L , f == null ? 0 : Marshal . GetFunctionPointerForDelegate ( f ) , ud ) ;
529529 }
530530
531531 public static double lua_tonumber ( lua_State L , int i )
@@ -548,7 +548,7 @@ public static ulong lua_tounsigned(lua_State L, int i)
548548
549549 public static void lua_pop ( lua_State L , int n )
550550 {
551- lua_settop ( L , - ( n ) - 1 ) ;
551+ lua_settop ( L , - n - 1 ) ;
552552 }
553553
554554 public static void lua_newtable ( lua_State L )
@@ -629,10 +629,10 @@ public static void lua_pushglobaltable(lua_State L)
629629 public const int LUA_HOOKCOUNT = 3 ;
630630 public const int LUA_HOOKTAILCALL = 4 ;
631631
632- public const int LUA_MASKCALL = ( 1 << LUA_HOOKCALL ) ;
633- public const int LUA_MASKRET = ( 1 << LUA_HOOKRET ) ;
634- public const int LUA_MASKLINE = ( 1 << LUA_HOOKLINE ) ;
635- public const int LUA_MASKCOUNT = ( 1 << LUA_HOOKCOUNT ) ;
632+ public const int LUA_MASKCALL = 1 << LUA_HOOKCALL ;
633+ public const int LUA_MASKRET = 1 << LUA_HOOKRET ;
634+ public const int LUA_MASKLINE = 1 << LUA_HOOKLINE ;
635+ public const int LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT ;
636636
637637 [ DllImport ( DllName , CallingConvention = Convention ) ]
638638 public static extern int lua_getstack ( lua_State L , int level , lua_Debug ar ) ;
@@ -678,15 +678,15 @@ public static void lua_pushglobaltable(lua_State L)
678678 private static extern int _lua_sethook ( lua_State L , nint func , int mask , int count ) ;
679679 public static int lua_sethook ( lua_State L , lua_Hook ? func , int mask , int count )
680680 {
681- return _lua_sethook ( L , func == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_Hook > ( func ) , mask , count ) ;
681+ return _lua_sethook ( L , func == null ? 0 : Marshal . GetFunctionPointerForDelegate ( func ) , mask , count ) ;
682682 }
683683
684684 [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_gethook" ) ]
685685 private static extern nint _lua_gethook ( lua_State L ) ;
686686 public static lua_Hook ? lua_gethook ( lua_State L )
687687 {
688688 nint ret = _lua_gethook ( L ) ;
689- return ret == ( ( nint ) 0 ) ? null : Marshal . GetDelegateForFunctionPointer < lua_Hook > ( ret ) ;
689+ return ret == 0 ? null : Marshal . GetDelegateForFunctionPointer < lua_Hook > ( ret ) ;
690690 }
691691
692692 [ DllImport ( DllName , CallingConvention = Convention ) ]
@@ -839,7 +839,7 @@ public static int luaL_loadfile(lua_State L, string f)
839839 private static extern void _luaL_requiref ( lua_State L , string modname , nint openf , int glb ) ;
840840 public static void luaL_requiref ( lua_State L , string modname , lua_CFunction ? openf , int glb )
841841 {
842- _luaL_requiref ( L , modname , openf == null ? ( ( nint ) 0 ) : Marshal . GetFunctionPointerForDelegate < lua_CFunction > ( openf ) , glb ) ;
842+ _luaL_requiref ( L , modname , openf == null ? 0 : Marshal . GetFunctionPointerForDelegate ( openf ) , glb ) ;
843843 }
844844
845845 public static void luaL_newlibtable ( lua_State L , luaL_Reg [ ] l )
@@ -883,12 +883,12 @@ public static int luaL_optint(lua_State L, int n, lua_Integer d)
883883
884884 public static long luaL_checklong ( lua_State L , int n )
885885 {
886- return ( long ) luaL_checkinteger ( L , n ) ;
886+ return luaL_checkinteger ( L , n ) ;
887887 }
888888
889889 public static long luaL_optlong ( lua_State L , int n , lua_Integer d )
890890 {
891- return ( long ) luaL_optinteger ( L , n , d ) ;
891+ return luaL_optinteger ( L , n , d ) ;
892892 }
893893
894894 public static string ? luaL_typename ( lua_State L , int i )
0 commit comments