OnClientNativeUiResult

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 02:08, 11 October 2026 by QCherry (talk | contribs) (Document native HUD/menu Lua APIs available since 0.1.7; client BUILD202 and save/load protection)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onClientNativeUiResult

AVAILABLE FROM UPDATE 0.1.7
This event is available in G1R:MP 0.1.7 and later. The contract below includes the compatibility guarantees introduced in that update.

Delivers a native HUD/menu policy acknowledgement to the owning resource's resourceRoot. A result concerns policy readiness, not a screenshot or guarantee that every widget currently exists.

Availability

This event is available in client scripts.

Callback signature

function(requestId, ok, reason, stateJson)

Parameters

Name Type Description
requestId number Request ID returned by a native UI mutator.
ok boolean Whether the requested native policy is currently applied and ready.
reason string Typically applied or waiting-for-native-ui.
stateJson string JSON-encoded native snapshot. Use fromJSON to decode, or getNativeUiState for the full resource state table.

Examples

addEventHandler("onClientNativeUiResult", resourceRoot,
    function(requestId, ok, reason, stateJson)
        outputDebugString("Native UI " .. tostring(requestId) .. ": " .. reason)
    end)
local latestRequest = showNativeHud(false)

Notes

  • Client-side only; available since 0.1.7. Use client BUILD202 or newer with a compatible Protocol 39 server.
  • See Native HUD and menus for asynchronous acknowledgements, resource ownership, input and restoration.
  • Register before submitting. Multiple changes can coalesce; intermediate request IDs are not guaranteed a result.
  • A waiting result may later be followed by applied for the same ID. Do not assume exactly one result per request.
  • Rejected requests returning false do not produce a native acknowledgement. Compare the event ID with your latest accepted request.
  • The stateJson snapshot differs from the full getNativeUiState table; requested masks and local pending/fresh fields belong to the latter.