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 »
Global Functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Global Functions
11-08-2017, 07:08 PM,
#13
Kosmos Offline
GMod Admin
Posts: 180
Threads: 3
Joined: Dec 2013
RE: Global Functions
(11-08-2017, 05:45 PM)Person8880 Wrote: What are the use-cases that people have for overriding default functions?
The main reason to alter built-in functions is because you actually want code you didn't write to behave differently. The example I made which causes error to spit out a stack trace instead of just the message is but one, and sadly allowing that does pose the threat that the error function doesn't throw an error (which is obviously bad).
There's also the common practice of overriding the type function to add custom types. There's also some ridiculous examples like getScripts returning a number of virtual files that are being loaded from the web, the place where SF creates it's files, or (something I've been working on) loading encrypted scripts.
As for modifying default functions being discouraged, I do believe that the current 'standard' for libraries is to dump their contents into the global environment. And I did that for quite some time too.
However, I don't think a "but Lua has it" argument leads anywhere, Lua also has the debug library.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Global Functions - by Red The Blue Color - 10-08-2017, 09:59 PM
RE: Global Functions - by Obi - 10-08-2017, 10:02 PM
RE: Global Functions - by Skeleton - 10-08-2017, 10:08 PM
RE: Global Functions - by Salira - 10-08-2017, 10:08 PM
RE: Global Functions - by 4N0NYM - 10-08-2017, 10:08 PM
RE: Global Functions - by TheOneAndOnlyTee - 10-08-2017, 10:15 PM
RE: Global Functions - by Red The Blue Color - 10-08-2017, 10:17 PM
RE: Global Functions - by Skeleton - 10-08-2017, 10:24 PM
RE: Global Functions - by Kosmos - 11-08-2017, 04:32 PM
RE: Global Functions - by Person8880 - 11-08-2017, 05:45 PM
RE: Global Functions - by Red The Blue Color - 11-08-2017, 06:50 PM
RE: Global Functions - by Skeleton - 11-08-2017, 06:45 PM
RE: Global Functions - by Kosmos - 11-08-2017, 07:08 PM
RE: Global Functions - by Person8880 - 11-08-2017, 07:12 PM
RE: Global Functions - by Red The Blue Color - 11-08-2017, 08:27 PM

  • 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.