The same change in Lua and BASIC
On this page
Lua#
Create a Lua script record, validate and apply it, then call it from an action list. This version uses the shared ChangeVariable action helper.
local Script = {}function Script.run(context)
await(ChangeVariable({
name = "score", operation = "add", value = 5
}))
return true
endreturn ScriptBASIC#
Create a BASIC script record with this source. The wrapper identifies PCA 3D BASIC 1.0, and AWAIT calls the same variable-changing helper.
OPTION PCA3D BASIC 1.0
FUNCTION Run(context AS Dictionary)
AWAIT ChangeVariable({"name": "score", "operation": "add", "value": 5})
RETURN TRUE
END FUNCTION| Test run | Score before | Score after |
|---|---|---|
| Lua helper | 20 | 25 |
| BASIC helper | 25 | 30 |
| PCA Script global | 30 | 35 |
These changes all reached the same shared score in the runtime test. Lua locals and ordinary BASIC local/private values remain script data; they do not become designer records just because they use the same name.
BASIC also provides GLOBAL / SHARED declarations for runtime state. For the small example here, using ChangeVariable keeps the operation explicit and avoids confusing local declarations with the global designer value.
