Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 6 7 8 9 10 … 18 Next »
require() execute-only files allows us to modify them
Thread Closed 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
require() execute-only files allows us to modify them
06-08-2017, 05:45 PM, (This post was last modified: 07-08-2017, 01:11 AM by Skeleton.)
#1
Skeleton Offline
Cheating Donating Member ( ͡° ͜ʖ ͡°)
****
Posts: 199
Threads: 30
Joined: Nov 2014
require() execute-only files allows us to modify them
[Image: snip.png]

[Image: giphy.gif]
Find
06-08-2017, 06:09 PM,
#2
Kosmos Offline
GMod Admin
Posts: 180
Threads: 3
Joined: Dec 2013
RE: require() execute-only files allows us to modify them
You can work around that by doing this:
Code:
local function fatal(msg, level) error(msg, level or 0 + 1) return "error" + "error" end
This causes the Lua engine itself to throw an error if the function does not. pcall might still catch this, but the code gets aborted still, so you get what you want. In addition, for legit users everything works as it should.

Note: 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).
Find
06-08-2017, 06:10 PM, (This post was last modified: 07-08-2017, 01:11 AM by Skeleton.)
#3
Skeleton Offline
Cheating Donating Member ( ͡° ͜ʖ ͡°)
****
Posts: 199
Threads: 30
Joined: Nov 2014
RE: require() execute-only files allows us to modify them
[Image: snip.png]

[Image: giphy.gif]
Find
06-08-2017, 06:49 PM,
#4
Kosmos Offline
GMod Admin
Posts: 180
Threads: 3
Joined: Dec 2013
RE: require() execute-only files allows us to modify them
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.
Find
06-08-2017, 06:53 PM, (This post was last modified: 07-08-2017, 01:12 AM by Skeleton.)
#5
Skeleton Offline
Cheating Donating Member ( ͡° ͜ʖ ͡°)
****
Posts: 199
Threads: 30
Joined: Nov 2014
RE: require() execute-only files allows us to modify them
[Image: snip.png]

[Image: giphy.gif]
Find
« Next Oldest | Next Newest »
Thread Closed 


  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.