SendNUIMessage
Use this to send data to the NUI (NewUI)
Syntax
SendNUIMessage(table data)
Required arguments
- data data that will be sent and received in NUI
Examples
LUA
SendNUIMessage({
hello = "world",
action = "showMessage"
})
JS (NUI PART)
window.addEventListener('message', (event) => {
let data = event.data
if(data.action == 'showMessage') {
console.log(`Hello ${data.hello}!`) // will print Hello world! in the console (F8)
}
})
Last modified May 22, 2020: Completely rewrote SendNUIMessage documentation (eb771e4)