General > Developers Corner

attempt to index global 'ULib' (a nil value) help please

(1/3) > >>

atomic-cruncher:
Someone told me this execute command: ULib.ucl.addUser( ply:SteamID(), nil, nil, "donator" ) but i get this error when running server[ERROR] lua/autorun/donationkeys.lua:15: attempt to index global 'ULib' (a nil value)1. unknown - lua/autorun/donationkeys.lua:15 ulx and ulib is installed anyways so i don't know the clue

Neku:

--- Code: ---ULib.ucl.addUser( ply:SteamID(), nil, nil, "donator" )
--- End code ---

What're those "nil"s doing there?

atomic-cruncher:

--- Quote from: Ven01273 on January 12, 2014, 02:59:26 AM ---
--- Code: ---ULib.ucl.addUser( ply:SteamID(), nil, nil, "donator" )
--- End code ---

What're those "nil"s doing there?

--- End quote ---
something for allowed and refused but I don't need those so I just fill in nil

Megiddo:
Are you calling module() in donationkeys.lua on an earlier line?

Or are you calling ULib from the global scope, before it has a chance to load?

JamminR:
Easiest quickest way to make sure ULib has loaded first..imo, is not use autorun folder for Ulib needed code.
Use addons\<your_addon>\lua\ulib\modules\<your file>

As the \addons\ulib\lua\ulib\modules\what_is_this.txt states

--- Quote ---This folder is similar to the lua/autorun folder, except all scripts in this folder are loaded after ULib.
Scripts in this directory are shared ( loaded both server and client side ).
Scripts in the client and server sub-folders are loaded only on the client and server respectively.
--- End quote ---

Same for ULX (if using ulx functions), but replace ulib with ulx in the addon folder path.

Navigation

[0] Message Index

[#] Next page

Go to full version