API
Exports and the event a script uses to plug into the core as a module.
Exports
| Export | Side | Purpose |
|---|---|---|
RegisterModule(data) | Server | Register a script as a module |
SetModuleEnabled(enabled) | Server | Set the tile status to active or disabled (boolean) |
HasModuleAccess(source) | Server | Checks access to the calling module (hub admin, group or licence) |
OpenHub() | Client | Back to the hub |
Registering a module
A module registers at start and again whenever lumina_core restarts. lumina_core belongs in the module's dependencies.
local function registerModule()
exports.lumina_core:RegisterModule({
label = 'My module',
description = 'Short description for the tile.',
icon = 'mail',
image = 'web/dist/module.webp' -- optional, 16:9, listed under files in the manifest
})
exports.lumina_core:SetModuleEnabled(true)
end
registerModule()
AddEventHandler('onResourceStart', function(resource)
if resource == 'lumina_core' then
registerModule()
end
end)
-- Triggered by the core when someone clicks the tile
AddEventHandler(('%s:server:openAdmin'):format(GetCurrentResourceName()), function(source)
if not exports.lumina_core:HasModuleAccess(source) then
return
end
-- Open the admin interface
end)
Fields of RegisterModule
| Field | Required | Rule |
|---|---|---|
label | yes | 1–48 characters |
description | yes | 1–160 characters |
icon | yes | grid, car, home, mail, chart, vote, shield, box, user, tool, bell, file, map, sliders |
image | no | Relative path to a .webp file |
The core reads the version from the module's fxmanifest.lua; it must have the form X.Y.Z. Invalid values raise an error.
Check
HasModuleAccesson the server for every admin action, not only when opening.