Add the import
fxmanifest.lua
UgCore.
What runs where
The import loads part of ug-core into your resource and proxies the rest to ug-core’s exports:Local, in your resource
Callback, Network, Events, Schema, Logger, Enums, Modules, Version, Lifecycle, and RateLimit on the server.No export call per request. Logger prints in your resource’s console.Proxied to ug-core
Config, Guard and Hooks on the server, Config on clients, and every enabled module namespace: Players, Accounts, Jobs and the rest.Data crosses the export boundary as a copy.Errors you can get
TheUgCore root is read-only and checks every name you use:
Waiting for ug-core
If your resource starts while ug-core is still booting, module namespaces raiseUgCore.Accounts is not available until ug-core is ready. Wait first:
server.lua
UgCore.Lifecycle.On('Ready', handler) does the same without blocking, and runs right away if ug-core is already ready.
Optional modules
Check before using a module your resource can live without:UgCore.Modules.Require('accounts') raises a clear error when a module you cannot live without is disabled.
Editor support
UgCore is fully annotated for the Lua language server. Add the ug-core folder to your library to get autocomplete, types and typo checks. Add it next to the FiveM natives in your VS Code settings:settings.json
A
workspace.library in a .luarc.json replaces the list from your editor settings, including the FiveM natives. Keep library paths in one place.