diff --git a/GarrysModLuaShared/GarrysModLuaShared/DllMain.cs b/GarrysModLuaShared/GarrysModLuaShared/DllMain.cs index a70aa31..50c6d45 100644 --- a/GarrysModLuaShared/GarrysModLuaShared/DllMain.cs +++ b/GarrysModLuaShared/GarrysModLuaShared/DllMain.cs @@ -10,6 +10,7 @@ static class DllMain [DllExport(CallingConvention = CallingConvention.Cdecl)] public static int gmod13_open(IntPtr luaState) { + RegisterCFunction(luaState, nameof(MyCSharpLibrary), nameof(MyCSharpLibrary.MyCSharpFunction), MyCSharpLibrary.MyCSharpFunction); return 0; } diff --git a/GarrysModLuaShared/GarrysModLuaShared/GarrysModLuaShared.csproj b/GarrysModLuaShared/GarrysModLuaShared/GarrysModLuaShared.csproj index 4943ebc..32260d7 100644 --- a/GarrysModLuaShared/GarrysModLuaShared/GarrysModLuaShared.csproj +++ b/GarrysModLuaShared/GarrysModLuaShared/GarrysModLuaShared.csproj @@ -37,6 +37,7 @@ + diff --git a/GarrysModLuaShared/GarrysModLuaShared/MyCSharpLibrary.cs b/GarrysModLuaShared/GarrysModLuaShared/MyCSharpLibrary.cs new file mode 100644 index 0000000..89c64c1 --- /dev/null +++ b/GarrysModLuaShared/GarrysModLuaShared/MyCSharpLibrary.cs @@ -0,0 +1,14 @@ +using System; +using static GarrysModLuaShared.Global; + +namespace GarrysModLuaShared +{ + static class MyCSharpLibrary + { + public static int MyCSharpFunction(IntPtr luaState) + { + print(luaState, "Hello from C# binary module!"); + return 0; + } + } +} \ No newline at end of file