triggerLatentClientEvent
This function was partially migrated from the old wiki. Please review manually:
- Missing section: triggerClientEvent vs triggerLatentClientEvent test by DreTaX
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function is the same as triggerClientEvent except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred.
You should avoid triggering events on the root element unless you really need to. Doing this triggers the event on every element in the element tree , which is potentially very CPU intensive. Use as specific (i.e. low down the tree) element as you can.
Syntax
bool triggerLatentClientEvent ( [ [table/element sendTo = getRootElement( ] )Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- sendTo (default: getRootElement(): The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements.
Returns
- bool: value
Returns true if the event trigger has been sent, false if invalid arguments were specified.
Code Examples
addEvent("onClientReadFile",true)addEventHandler("onClientReadFile",root,function(data) local file = fileCreate("text.txt") --Save "data" into "text.txt" fileWrite(file,data) fileClose(file)end)