![]() |
|
require() execute-only files allows us to modify them - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Starfall (https://teamscm.co.uk/forum-7.html) +--- Thread: require() execute-only files allows us to modify them (/thread-2409.html) |
require() execute-only files allows us to modify them - Skeleton - 06-08-2017
RE: require() execute-only files allows us to modify them - Kosmos - 06-08-2017 You can work around that by doing this: Code: local function fatal(msg, level)
error(msg, level or 0 + 1)
return "error" + "error"
endNote: I don't think there's anything beyond that you can do. What you're describing is an intentional feature of Lua - and it's the basis of all libraries. You could ask person to run every included file within it's own global environment, effectively preventing this, but no library would work anymore. And besides that, someone might want to redefine the error function like this (like me, so that the error message includes the stack trace, very useful for debugging). RE: require() execute-only files allows us to modify them - Skeleton - 06-08-2017
RE: require() execute-only files allows us to modify them - Kosmos - 06-08-2017 You misread the code, there will be an error because you're trying to add two string variables, the return is simply a guarantee that it doesn't get optimized away. If you think someone is messing with your code then you can also add them to the chip's blacklist. RE: require() execute-only files allows us to modify them - Skeleton - 06-08-2017
|