Closed Denneisk closed 3 months ago
The hasObject postInit setting is really cumbersome. Just use EGP.HasObject instead of localizing it, or define it before including those files.
There's a bit of overlap in all of the libraries so it's going to be more than just hasObject
, and I'd prefer to keep EGP.HasObject
localized because (especially right now) it's extremely expensive and common. I could change it to use an array defined in EGP
or just use a hook I guess. I'll agree that scrolling to the bottom of the code to see if you defined something is pretty bad.
Hopefully this is a decent compromise. Same thing just more permissive.
Conflicts
Tidies up things and adds comments everywhere for good measure. Part one of an eventual refactor of EGP library entirely. (Is it really a refactor with this many API changes?)
Although I renamed the file, GH will not tolerate it, so sorry, I just felt like
objectcontrol.lua
was an outdated name. I can't be the only one, right? You can observe https://github.com/wiremod/wire/commit/0d75e21f63229e71a0e41cecf10aba06a44c24ec for most of the diff, or view the diff on your own. For your convenience, I've exported the diff for you here. If you see a problem, check the later commits in case they're fixed.Certain method calls were changed to function calls preceded with
nil
. This was just an oversight thinking certain functions were not methods, and now it just serves as a memory aid that they're not actual methods.Asking for testers
Noteworthy changes by file:
gmod_wire_expression2/core/e2lib.lua
gmod_wire_egp/lib/init.lua
EGP
a subtable ofE2Lib
to avoid global pollution.EGP
still exists for backwards compatibility and will be removed once everything is done.EGP.HookPostInit
function as a simple postinit handlergmod_wire_egp/lib/egplib/objectcontrol.lua
objects.lua
objects
). Numerical indices track IDs while string keys track object names. Greatly simplifies getter logic.EGP.GetObjectByID
EGPObject
base and metatable.IsValid
metatable method.EGPObject
type.EGP
for future use.baseObj.EditObject
when they should be calling their ownself.EditObject
to initialize instead.baseObj.Set
to callSetObject
if a position key is foundbaseObj
initialization to a single table initializerNULL_EGPOBJECT
to be anEGPObject
object instead of its own specialized metatableEGP.IsEGPObject
EGP.NewObject
to fit new APIEGP.InheritObject
EGP.EditObject
EGP.HasObject
EGP.SetOrder
EGP.PerformReorder
EGP.PerformReorder_Ex
EGP.CreateObject
->EGP.Create
Entity, string|integer, table
tostring|integer, table, Entity
gmod_wire_expression2/core/egpfunctions.lua
EGP.HasObject
with localized versionEGP.CreateObject
with updated, localized versionself.player
argumentEGP.EditObject
with EGP Object methodgmod_wire_expression2/core/egpobjects.lua
EGPObject.IsValid
for validity checkingEGP.HasObject
with localized versionEGP.CreateObject
with updated, localized versionself.player
argumentEGP.EditObject
with EGP Object methodremove
e2functions to not change metatableAll other changes were too small/insignificant and mostly involve changing/replacing usage of a few functions.