@@ -167,8 +167,12 @@ public static int lua_upvalueindex(int i)
167
167
public const int LUA_RIDX_GLOBALS = 2 ;
168
168
public const int LUA_RIDX_LAST = LUA_RIDX_GLOBALS ;
169
169
170
- [ DllImport ( DllName , CallingConvention = Convention ) ]
171
- public static extern lua_State lua_newstate ( lua_Alloc f , voidp ud ) ;
170
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_newstate" ) ]
171
+ public static extern lua_State _lua_newstate ( charp f , voidp ud ) ;
172
+ public static lua_State lua_newstate ( lua_Alloc ? f , voidp ud )
173
+ {
174
+ return _lua_newstate ( f == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_Alloc > ( f ) , ud ) ;
175
+ }
172
176
173
177
[ DllImport ( DllName , CallingConvention = Convention ) ]
174
178
public static extern void lua_close ( lua_State L ) ;
@@ -438,11 +442,19 @@ public static int lua_pcall(lua_State L, int n, int r, int f)
438
442
return lua_pcallk ( L , n , r , f , null , null ) ;
439
443
}
440
444
441
- [ DllImport ( DllName , CallingConvention = Convention ) ]
442
- public static extern int lua_load ( lua_State L , lua_Reader reader , voidp dt , string chunkname , string ? mode ) ;
445
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_load" ) ]
446
+ public static extern int _lua_load ( lua_State L , charp reader , voidp dt , string chunkname , string ? mode ) ;
447
+ public static int lua_load ( lua_State L , lua_Reader ? reader , voidp dt , string chunkname , string ? mode )
448
+ {
449
+ return _lua_load ( L , reader == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_Reader > ( reader ) , dt , chunkname , mode ) ;
450
+ }
443
451
444
- [ DllImport ( DllName , CallingConvention = Convention ) ]
445
- public static extern int lua_dump ( lua_State L , lua_Writer writer , voidp data , int strip ) ;
452
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_dump" ) ]
453
+ public static extern int _lua_dump ( lua_State L , charp writer , voidp data , int strip ) ;
454
+ public static int lua_dump ( lua_State L , lua_Writer ? writer , voidp data , int strip )
455
+ {
456
+ return _lua_dump ( L , writer == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_Writer > ( writer ) , data , strip ) ;
457
+ }
446
458
447
459
[ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_yieldk" ) ]
448
460
public static extern int _lua_yieldk ( lua_State L , int nresults , charp ctx , charp k ) ;
@@ -465,8 +477,12 @@ public static int lua_yield(lua_State L, int n)
465
477
return lua_yieldk ( L , n , null , null ) ;
466
478
}
467
479
468
- [ DllImport ( DllName , CallingConvention = Convention ) ]
469
- public static extern void lua_setwarnf ( lua_State L , lua_WarnFunction f , voidp ud ) ;
480
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_setwarnf" ) ]
481
+ public static extern void _lua_setwarnf ( lua_State L , charp f , voidp ud ) ;
482
+ public static void lua_setwarnf ( lua_State L , lua_WarnFunction ? f , voidp ud )
483
+ {
484
+ _lua_setwarnf ( L , f == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_WarnFunction > ( f ) , ud ) ;
485
+ }
470
486
471
487
[ DllImport ( DllName , CallingConvention = Convention ) ]
472
488
public static extern void lua_warning ( lua_State L , string msg , int tocont ) ;
@@ -503,10 +519,14 @@ public static int lua_yield(lua_State L, int n)
503
519
public static extern size_t lua_stringtonumber ( lua_State L , string s ) ;
504
520
505
521
[ DllImport ( DllName , CallingConvention = Convention ) ]
506
- public static extern lua_Alloc lua_getallocf ( lua_State L , ref voidp ud ) ;
522
+ public static extern lua_Alloc lua_getallocf ( lua_State L , out voidp ud ) ;
507
523
508
- [ DllImport ( DllName , CallingConvention = Convention ) ]
509
- public static extern void lua_setallocf ( lua_State L , lua_Alloc f , voidp ud ) ;
524
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_setallocf" ) ]
525
+ public static extern void _lua_setallocf ( lua_State L , charp f , voidp ud ) ;
526
+ public static void lua_setallocf ( lua_State L , lua_Alloc ? f , voidp ud )
527
+ {
528
+ _lua_setallocf ( L , f == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_Alloc > ( f ) , ud ) ;
529
+ }
510
530
511
531
[ DllImport ( DllName , CallingConvention = Convention ) ]
512
532
public static extern void lua_toclose ( lua_State L , int idx ) ;
@@ -693,11 +713,20 @@ public static int lua_setuservalue(lua_State L, int idx)
693
713
[ DllImport ( DllName , CallingConvention = Convention ) ]
694
714
public static extern void lua_upvaluejoin ( lua_State L , int fidx1 , int n1 , int fidx2 , int n2 ) ;
695
715
696
- [ DllImport ( DllName , CallingConvention = Convention ) ]
697
- public static extern void lua_sethook ( lua_State L , lua_Hook func , int mask , int count ) ;
716
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_sethook" ) ]
717
+ public static extern void _lua_sethook ( lua_State L , charp func , int mask , int count ) ;
718
+ public static void lua_sethook ( lua_State L , lua_Hook ? func , int mask , int count )
719
+ {
720
+ _lua_sethook ( L , func == null ? IntPtr . Zero : Marshal . GetFunctionPointerForDelegate < lua_Hook > ( func ) , mask , count ) ;
721
+ }
698
722
699
- [ DllImport ( DllName , CallingConvention = Convention ) ]
700
- public static extern lua_Hook lua_gethook ( lua_State L ) ;
723
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "lua_gethook" ) ]
724
+ public static extern charp _lua_gethook ( lua_State L ) ;
725
+ public static lua_Hook ? lua_gethook ( lua_State L )
726
+ {
727
+ charp ret = _lua_gethook ( L ) ;
728
+ return ret == IntPtr . Zero ? null : Marshal . GetDelegateForFunctionPointer < lua_Hook > ( ret ) ;
729
+ }
701
730
702
731
[ DllImport ( DllName , CallingConvention = Convention ) ]
703
732
public static extern int lua_gethookmask ( lua_State L ) ;
@@ -855,7 +884,7 @@ public static int luaL_loadfile(lua_State L, string f)
855
884
[ DllImport ( DllName , CallingConvention = Convention ) ]
856
885
public static extern void luaL_traceback ( lua_State L , lua_State L1 , string msg , int level ) ;
857
886
858
- [ DllImport ( DllName , CallingConvention = Convention ) ]
887
+ [ DllImport ( DllName , CallingConvention = Convention , EntryPoint = "luaL_requiref" ) ]
859
888
public static extern void _luaL_requiref ( lua_State L , string modname , charp openf , int glb ) ;
860
889
public static void luaL_requiref ( lua_State L , string modname , lua_CFunction ? openf , int glb )
861
890
{
0 commit comments