Skip to content

fix(exports): keep callbacks that other resources pass through an export - #310

Merged
Github-Samuel merged 1 commit into
mainfrom
fix/export-callbacks
Oct 10, 2026
Merged

Github-Samuel merged 1 commit into
mainfrom
fix/export-callbacks

Conversation

@Github-Samuel

Copy link
Copy Markdown
Member

Summary

A function handed to an export by another resource arrives as a function reference: a table with a __call metamethod, not a Lua function. #304 fixed this for Bluetooth devices. The same type(x) == 'function' check sat on every other export that takes a callback, so the callback was dropped for exactly the callers those exports exist for:

  • uploadMedia returned false for any outside caller and never answered.
  • showLockscreenWidget dropped onAction, so the owning resource never heard a tap.
  • addCustomApp dropped onOpen / onUse / onClose / onDelete.
  • The lb-phone SendMessage shim skipped its callback, and the qs registerCallInterceptor shim refused the registration.

Changes

Testing

Live on a QBox dev server, calling from a second resource:

  • Confirmed the shape: a function crossing a resource boundary is type = table with __call.
  • uploadMedia: before, returned false and the callback never ran. After, the callback receives Expected a base64 data: URL. A plain table is still refused.
  • Bluetooth: onConnect and onDisconnect (reason kicked) both fire.
  • Custom app: onOpen, onClose and onDelete fire on their lifecycle actions.
  • Lock screen widget: onAction receives the action and its value.

Not exercised: the two compat shim callbacks.

Lua suite: 597 passed, with the same two suite errors as main (port_settings_test, port_photogram_test). The new callable cases fail when the helper is reverted to the function-only check.

Breaking Changes

None. Plain Lua functions pass as before; anything that is neither a function nor callable is still ignored.

@Github-Samuel
Github-Samuel merged commit 0a47628 into main Oct 10, 2026
1 check passed
@Github-Samuel
Github-Samuel deleted the fix/export-callbacks branch October 10, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant