lewisclark / glua-steal

Retrieves client-sided Lua files from Garry's Mod game servers
GNU General Public License v3.0
154 stars 15 forks source link

Including does not load instantly #17

Closed Vurv78 closed 4 years ago

Vurv78 commented 4 years ago

gluasteal.include ends up running much after autorun which is sad because I wanted to have actual proper file management without having stuff in my data folder where it could be tampered with.

I'd assume it would just be another call of luaL_loadFile (I have little to no experience sorry)

Is this intended behavior?

I guess i'll just put everything in one file for now (gluasteal.lua) 👎

lewisclark commented 4 years ago

gluasteal.include is executing the file when it's called, no delay in execution whatsoever. Try testing the code below on your system, it could be due to an issue with your code, such as using timers. If gluasteal.include still doesn't work as expected, please include your OS and the branch of Garry's Mod you're using so I can test.

-- gluasteal.lua
print("gluasteal.lua loading", gluasteal.SCRIPT)

gluasteal.include("test.lua")
-- test.lua
print("test.lua loaded", gluasteal.SCRIPT)

Garry's Mod console output

gluasteal.lua loading   lua/includes/init.lua
test.lua loaded 
gluasteal.lua loading   lua/includes/util.lua
test.lua loaded 
gluasteal.lua loading   lua/includes/util/color.lua
test.lua loaded 
gluasteal.lua loading   lua/includes/util/sql.lua
test.lua loaded 
...
Vurv78 commented 4 years ago

Will test in a bit, it does seem to be something with my script. I only noticed this because after doing this, an anticheat I've been using to test my stuff has been loading before the included file.

Vurv78 commented 4 years ago

Yeah, closing this. It was because I was trying to prematurely load the libraries like timer/hook etc but I'm assuming the crappy "anticheat" hooks itself onto it or changes those files, I guess I'll separate code using those libraries and code not. Thank you for making this, has saved me from the huge headache of making a loadbuffer hook myself