Cross-language calls and includes
On this page
LESSON 16
Let a single implementation of a puzzle rule serve Lua, GDScript and an action list.
Lua caller · bridge_lua#
local Script = {}function Script.run(context)
local helper = IncludeScript("archive_words")
helper:Set("last_room", "archive")
local answer = await(AwaitCall(helper, "Call", "normalize",
Array{" EAST "}))
return tostring(answer) .. "/" .. tostring(helper:Get("last_room"))
endreturn ScriptExpect east/archive. IncludeScript returns a call proxy. Set and Get use its shared included-variable
store. The proxy does not copy source or give you a reference to the other module's private locals.
Lua project records need no header files. A standalone Lua require uses the Lua package loader and
its search paths. Use project IDs and IncludeScript or CallScript for records packaged by PCA.
GDScript caller · complete native record#
func run() -> String:
var value = await CallScript("archive_words", "normalize", [" WEST "])
return str(value)From Lua use await(CallScript(id, functionName, Array{arguments})). The shared router also
supports PCA Script and BASIC records. Use unique record IDs across languages. RunVisualScript
takes a scriptId for a saved graph. RunVisualGraph takes the graph data itself. Return plain
numbers, strings, booleans and simple lists or dictionaries for portable results.
