GSGlobalHooks  - Optimization shortcut for Lua modders

[Open Assets] GSGlobalHooks - Optimization shortcut for Lua modders Example

What permissions do you give others to modify and/or maintain your submission?
Modify: YES - Maintain: YES - I give permission for my entire submission to be modified by others or used in their own work. I give permission for my entire submission to be maintained by others as well.
NOTE: This is an example mod for helping Lua modders! Loading it on it's own does NOT boost performance.

globalhooks-png.156579

Recently, several forms of global Lua hooks got deprecated. Many coders used them merely for convenience/laziness, not realizing how terribly much they killed SRB2's performance. That change means alot of mods break, though, and many coders lack the experience or will to optimize everything properly.

That's where this comes in!

Simply copy this into your mod and edit things as needed. Specify what flags, or thing type, or other properties your target objects have, and this script will add any local function you've made as a hook for all such objects. It auto-updates whenever new addons are added and prevents duplicate hooks, so there's no downside to using it over global hooks.

This is a HUGE performance upgrade over using global hooks, and should future-proof your mods. So if you ever want to make a hook that affects a LOT of similar objects at once, this is the most performant way to do it.

The script comes with some build-in examples to show how it works. Anyone may edit or reuse this freely for any purpose, and no credit needs to be given.
  • GlobalHooks.png
    GlobalHooks.png
    9.2 KB · Views: 1,218
Author
Golden Shine
Downloads
169
Views
952
Extension type
pk3
File size
1.6 KB
MD5 Hash
fd6459f6f933958b9e44eee84bbddf53
First release
Last update

More resources from Golden Shine

Share this resource

Back
Top