Closed StupidRepo closed 1 year ago
You have to use AddConsoleCommand
, not concommand.Add
if you want to add a console command before init.lua. This is because concommand.Add
is created in Lua as a result of init.lua executing; it is not a C function.
Thank you! How do I make the command call a function on run though? It seems like AddConsoleCommand
only takes the command name and some help text and not a function. I know it says it calls concommand.Run but I'm not sure how to detect when that's called... unless it's a hook?
Also, when I update gluasteal.lua does it update in real time as in like if I were to update it to print("HI") when init.lua occurs, it'd print HI when I next go into a server or do I have to reinject for it to update?
Basically, if gluasteal.lua contains this: print("HELLO") but then I update it to this: print("HI")
Will it still print HELLO or will it print HI?
Thank you! How do I make the command call a function on run though? It seems like
AddConsoleCommand
only takes the command name and some help text and not a function. I know it says it calls concommand.Run but I'm not sure how to detect when that's called... unless it's a hook?
All I wanna do is be able to run a command in my console to get an executer window up so I can run lua code within the game via a UI without having to restart it.
Thank you! How do I make the command call a function on run though? It seems like
AddConsoleCommand
only takes the command name and some help text and not a function. I know it says it calls concommand.Run but I'm not sure how to detect when that's called... unless it's a hook?
The engine calls concommand.Run
https://github.com/Facepunch/garrysmod/blob/39038361c65285a198660e7bc09623955aa44b2c/garrysmod/lua/includes/modules/concommand.lua#L45-L61. You would have to hook that function so you can listen for commands yourself.
Also, when I update gluasteal.lua does it update in real time as in like if I were to update it to print("HI") when init.lua occurs, it'd print HI when I next go into a server or do I have to reinject for it to update?
Basically, if gluasteal.lua contains this: print("HELLO") but then I update it to this: print("HI")
Will it still print HELLO or will it print HI?
Yes, it updates the file in real time - each time a file is executed by glua-steal it is re-read from disk.
It keeps giving me errors and I can't create a concommand before init.lua please help