This is a module to help with communication between lua states. Menu and Client to be specific.
It calls hooks on Menu and Client with strings. I would use tables, but because I can't just pass by reference between Lua interfaces, I'm just using strings for now. Feel free to add a PR to the github if you find a solution for using more advanced data types:
It's a pretty niche use case. I use it for a bot that I created to scan servers. Where Menu state is required to manage the bot between servers. I'm sure you'll find some use for it.
This
SHOULD work on linux, however I haven't built it yet, all premake files were included. It just requires garrysmod_common and sourcesdk-minimal.
Warning
It is NOT recommended that you have any sort of RunString/CompileString on hooks in the menu state. Menu state has a huge amount of control over your game and it's files, and you don't want any servers you join being able to run lua in menu state. Don't be stupid.
Usage:
Client
Code:
require("hookproxy")
CallOnMenu("hook name here", "string to pass here")
Menu
Code:
require("hookproxy")
CallOnClient("hook name here", "string to pass here")
Many thanks to LeenyPenny and meepen for their gm_roc module. I used meepens headers for this project and the gm_roc project was a great inspiration in this <3