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)
	}
})