File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 11# Lua.NET
22C# .NET Core 6.0 Lua bindings and helper functions
33
4- Example Usage:
4+ Example Usage Lua5.4.4 :
55``` C#
66namespace LuaNET ;
77
@@ -38,3 +38,39 @@ class Project
3838}
3939```
4040
41+ Example Usage LuaJIT:
42+ ``` C#
43+ namespace LuaNET ;
44+
45+ using static LuaJIT .Lua ;
46+
47+ class Project
48+ {
49+
50+ public static int lfunc (IntPtr L )
51+ {
52+ lua_getglobal (L , " print" );
53+ lua_pushstring (L , " lol" );
54+ lua_pcall (L , 1 , 0 , 0 );
55+ return 0 ;
56+ }
57+
58+ public static void Main (String [] args )
59+ {
60+
61+ IntPtr L = luaL_newstate ();
62+ if (L == IntPtr .Zero )
63+ {
64+ Console .WriteLine (" Unable to create context!" );
65+ }
66+ luaL_openlibs (L );
67+ lua_pushcfunction (L , lfunc );
68+ Console .WriteLine (lua_pcall (L , 0 , 0 , 0 ));
69+ lua_close (L );
70+
71+ Console .WriteLine (" Success" );
72+
73+ }
74+
75+ }
76+ ```
You can’t perform that action at this time.
0 commit comments