acquireElementStreamingLease
Acquires one resource-owned reference that keeps a streaming-compatible element present in the local GTA world.
Syntax
int|false acquireElementStreamingLease(element theElement)GTA task mapping
This is an MTA streaming-lifecycle primitive, not a CTask or SCM command. It prevents the normal stream-out path from destroying the local GTA instance while the reference remains live.
Arguments
theElementelementStreaming-compatible element to retain locally.
Returns
A non-zero resource-private token, or false for an invalid class, missing resource owner, or exhausted script-reference counter.
Ownership and lifecycle
Each token belongs to the client resource that acquired it and contributes one independent streaming reference. Element destruction invalidates its target, explicit release removes it, and resource shutdown releases every surviving token.
- Independent tokens compose on the same element.
- The legacy setElementStreamable boolean owns a separate reference and cannot release this token.
- Keeping the native instance alive preserves an already-running GTA task; it does not itself reconstruct work after a syncer change or deliberate release.
Example
local pedLease = assert(acquireElementStreamingLease(driver))local vehicleLease = assert(acquireElementStreamingLease(vehicle))Where this comes from
Continue exploring
← Back to the Neon Lua API · How Resource-owned streaming leases works →