• How do I make a GMod module?
    5 replies, posted
So, I know C++, I know Lua, and I have a basic sense on how the source engine works. How do I combine my skills to make a module for GMod? What if I want to use a 3rd party library? What happens then?
[url]http://wiki.garrysmod.com/page/Setting_Visual_Studio_Up_for_Making_Binary_Modules[/url] [url]http://wiki.garrysmod.com/page/Creating_Binary_Modules[/url] [url]http://www.lua.org/pil/24.2.html[/url] [url]http://www.lua.org/manual/5.2/manual.html#4.8[/url] [url]https://github.com/garrynewman/gmod-module-base/blob/master/example/src/gm_example.cpp[/url] GMod has [URL="https://github.com/garrynewman/gmod-module-base/blob/master/include/GarrysMod/Lua/LuaBase.h#L18"]its own interface[/URL] for C <-> Lua, but the functions are mostly just renames/wrappers for the normal Lua C functions. If you want access to the raw Lua C functions, they're exported in lua_shared.dll
Also, if you want to access a Source instance or object, it might be useful to know what to include: [url]https://github.com/ValveSoftware/source-sdk-2013[/url]
Thanks, guys! My first tests are going pretty well [editline]8th December 2015[/editline] I got a lot of stacking to do
A bit late but here's a good example of a very basic module. I'd also reccomend you use this as a base for your modules to keep includes to a minimum and to make your modules easy to build. [URL="https://github.com/glua/module-base"]https://github.com/glua/module-base[/URL]
If you're using the above project and premake5, [url]https://github.com/glua/SourceSDK[/url] is useful for anything that uses the SourceSDK (especially tier1 which people usually have issues compiling). Use like so: [url]https://github.com/glua/gm_stringtable[/url] & [url]https://github.com/glua/gm_stringtable/blob/master/premake5.lua[/url]
Sorry, you need to Log In to post a reply to this thread.