PIXELFALLS Lua Sugar
PIXELFALLS supports a small set of Lua syntax sugar operators. These are transformed into standard Lua before runtime/export.
For which standard libraries the runtime opens (math, string, table, and others), see Std Lua Libraries.
Supported operators
x++->x = x + 1x--->x = x - 1x += y->x = x + (y)x -= y->x = x - (y)x *= y->x = x * (y)x /= y->x = x / (y)x %= y->x = x % (y)
These also work for table/index targets, for example:
player.score++stats["hp"] -= 10items[i] *= 2
Comments and decrement
Lua uses -- for comments, so decrement support is postfix only.
- Supported:
x-- - Supported with comment:
x-- -- this is a comment - Not supported:
--x
What this means for portability
These operators are PIXELFALLS sugar, not standard Lua syntax. If you copy code into a plain Lua environment without this transform, you must rewrite them to explicit assignments.
Shared global state
PIXELFALLS runtime also provides a built-in shared table:
state— global table for data shared betweenmain.luaand nodes.- Define any global fields you require in
main>init()method.
Example:
-- main.lua state.score = 0 state.currentLevel = 0 state.playerName = "Unknown" -- player.lua state.score += 10 state.playerName = "Dave" drawText("Hello " .. state.playerName, 1, 1)