ug-lib is the UI and utility library of the UgCore ecosystem. It gives your resources notifications, prompts, progress bars, dialogs, menus and radials, plus Lua helpers for math, text, zones, entities and more.
It works with or without ug-core. The two never depend on each other: ug-core returns error codes and emits events, and your resource decides what the player sees through ug-lib.
What you get
UI services
Notify, TextUI, Progress, SkillCheck, Dialog, Context, Menu and Radial. One page, themed by the server owner.
Client utilities
Cache, Streaming, Entity, Raycast, Draw, Animation, Zone, Point and Keybind. They run in your resource.
Shared utilities
Math, Table, String, Format, Async and Locale, on the server and on clients.
Owner config
Positions, durations, keys, colors and language in two generated files.
Principles
- The page is untrusted. Anything the NUI page sends can be forged. Lua checks every answer against what it sent: a dialog value against its field, a menu choice against its items. See Security.
- Calls stay in your resource. Utilities run in your runtime. UI calls wait in your runtime and reach
ug-libthrough non-blocking exports. Callbacks andargsnever leave your resource. - Mistakes raise at your line. Wrong options raise with a suggestion:
Dialog.Input: field "plate" has an unknown option "maxLenght". Did you mean "maxLength"? - No network.
ug-libregisters no net events and has no callbacks. Notifications from the server go through your own client script. See Using ug-lib with UgCore.
Next steps
Installation
Download, start order and the first start.
Importing ug-lib
One shared script gives your resource
UgLib.