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
Linear Mode
require() execute-only files allows us to modify them
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
« Next Oldest | Next Newest »
Thread Closed 


Messages In This Thread
require() execute-only files allows us to modify them - by Skeleton - 06-08-2017, 05:45 PM
RE: require() execute-only files allows us to modify them - by Kosmos - 06-08-2017, 06:09 PM
RE: require() execute-only files allows us to modify them - by Skeleton - 06-08-2017, 06:10 PM
RE: require() execute-only files allows us to modify them - by Kosmos - 06-08-2017, 06:49 PM
RE: require() execute-only files allows us to modify them - by Skeleton - 06-08-2017, 06:53 PM

  • View a Printable Version
Forum Jump:


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

Powered By MyBB, © 2002-2026 MyBB Group.