Open Tripperful opened 4 years ago
Oof, some drm guys gonna be pissed it it gets released.
Hook all function run
if function line == -1 then it means it's a file that you run
If the file path seems suspicious it means it's runstring
dump bytecode/change values in it and boom
Well you can kinda already do this anyway
It's not a gmod hook, you can't really prevent a script from loading but you can hook files being loaded (after they were compiled to lua bytecode and called)
https://github.com/ExtReMLapin/BadCoderz/blob/master/lua/badcoderz/sh_compiled_functions.lua#L52
After the selected line on the link, it's code related to find runstring/compilestring code, modify it to fits your needs
This hook should be called every time any lua script is loaded/refreshed, not talking about RunString, just the regular lua files.
Script file path should be passed as an argument, and if the hook returns a string, this string is used as script content, instead of script file content.
What would this enable us to do: