FiveM Integration (Client/Lua)
This page covers how to work with the client (Lua) side of the lua-x-react boilerplate.
Sending Data to the UI
RegisterCommand("ui", function()
SetNuiFocus(true, true) -- allows mouse and keyboard input in the UI
SendReactMessage('configData', {
ServerName = cfg.ServerName,
MaxPlayers = cfg.MaxPlayers,
StartingMoney = cfg.StartingMoney,
isPvpEnabled = cfg.EnablePvP
})
end)SendNUIMessage({ type = 'showMessage', text = 'Hello from Lua!' })Receiving Data from the UI
RegisterNUICallback('myEvent', function(data, cb)
print('Received from UI:', data.foo)
cb('ok')
end)Setting NUI Focus
Last updated