Ulysses

General => Developers Corner => Topic started by: talmera on August 09, 2013, 01:12:28 AM

Title: question about fool proofing?
Post by: talmera on August 09, 2013, 01:12:28 AM
Is there a hook or something that allows me to check if an addon (in this case ULX/Ulib) is loaded on the server, I want to check to see if it is loaded and then run a ulx function in a script I'm tinkering with. I've tried checking facepunch and here but failed to find anything that would shed some light on this.
Title: Re: question about fool proofing?
Post by: MrPresident on August 09, 2013, 05:45:03 AM
There isn't a hook, but you can return the ULX table to check if it's been loaded yet.

Code: [Select]
if ulx then
    run code here
end
Title: Re: question about fool proofing?
Post by: JamminR on August 09, 2013, 02:07:34 PM
If your full addon requires ULX be loaded (not just some small function of it), you could also place your addon file in  <your_addon>/lua/ulx/modules</cl|/sv|/sh/&|>/file.lua.
Then it would like when ULX loads.

That gets tricky though if your full addon doesn't require it; but only that small command - then it becomes a 'which loads first, my code or ULX'. Luck of the draw at that point.
You wouldn't want the function to run as  ULX is loading if your other code hadn't loaded first.
Title: Re: question about fool proofing?
Post by: MrPresident on August 09, 2013, 06:56:11 PM
Also, that assumes his addon (assuming it is an addon) is only one file and has no other dependencies.
Title: Re: question about fool proofing?
Post by: talmera on September 20, 2013, 07:57:43 PM
Also, that assumes his addon (assuming it is an addon) is only one file and has no other dependencies.

sorry for the late reply, I was making it so it was compatible with multiple admin packages, thank you for the answer MrPresident.