export_namespace
Exports a callback of the calling script as a function in a script namespace, so that any script (in any language) can call it.
The callback is either a function registered with
register_callback, or a top level function with that name. Calls run in the exporting script and return what the callback returns.register_callback("spawn_enemy_impl", function(health) ... end) export_namespace("script.game", "spawn_enemy", "spawn_enemy_impl") -- in another script, once the first one has run import_namespace("script.game").spawn_enemy(5)
Arguments
| Name | Type | Documentation |
|---|---|---|
| name | String | the name of the function within the namespace. |
| callback | String | the label of the callback of this script to export. |
| arg3 | String | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the function was exported. |