General > Developers Corner
Standalone addon, visibility to ULX functionality?
(1/1)
ambro:
I have an addon for ULX I've been working that uses ULX functionality and is currently stored in /garrysmod/addons/ulx/lua/ulx/modules/sh/
I'd like to move it to: /garrysmod/addons/myaddonname/lua/autorun/mymodule.lua
I thought I did everything correctly but I'm getting:
[ERROR] addons/ambrosutilitymod/lua/autorun/ambro_util.lua:29: attempt to index global 'ulx' (a nil value)
1. unknown - addons/ambrosutilitymod/lua/autorun/ambro_util.lua:29
Relevant line, pseudo code:
--- Code: ---local CATEGORY_NAME = "Utility"
function ulx.rules( calling_ply, target_plys, command )
do stuff here....
end
local rules = ulx.command( CATEGORY_NAME, "ulx rules", ulx.rules, "!rules" )
rules:addParam{ type=ULib.cmds.PlayersArg }
rules:defaultAccess( ULib.ACCESS_ADMIN )
rules:help( "Broadcasts the server rules to the target(s)." )
--- End code ---
How do I make this standalone addon have the same visibility let's say, fun.lua or utility.lua has without having the file in that directory?
The reason I want to do this is so that in the event I update ULX, I won't have to keep messing with copying the file back over, etc.
Thank you for the help.
MrPresident:
It doesn't work because ulx calls its modules, and by placing yours into a general lua/autorun directory its being called before ulx is loaded into memory. To fix this, just create a lua/ulx/modules/sh/ directory in you own add-on folder.
ambro:
Great,
Thank you!
Navigation
[0] Message Index
Go to full version