Scripting in Floptle (Lua)
Scripting in Floptle (Lua)
Game logic in Floptle is written in Lua. A script is a .lua file in your
project's scripts/ folder. Attach it to a node and it runs every frame while the
game is playing. Scripts hot-reload — save the file and the running game picks
it up immediately.
This page teaches; lua-api.md lists. The guide is in chapters:
read one end to end and you have that part of the engine, or dip into one when you
need it. The reference has every call the engine answers, grouped and searchable,
for when you already know the name and want the signature.
The same chapters are in the editor — Scripting tab → § Docs → 📖 Guides, with the contents down the left — and every call shows up as autocomplete and hover hints as you type. All three are generated from one table, so they cannot disagree.
Section numbers are stable and are what the engine's own messages cite ("see scripting.md §16"), so they stay put even when a chapter is rearranged around them.
Start here
Your first script, the hooks the engine calls, and the globals every script has.
- 1. A first script
- 2. Lifecycle:
start,update,fixedUpdate - 6. Globals:
params,time,dt,log - 12. Recipe: a walkable first-person character
- 13. Bundled example scripts
Nodes & the scene
Moving things, finding things, and swapping the whole world out.
- 3.
node— the transform - 8. Referencing other nodes & scripts
- 17. Scenes:
scene.load& the entry scene - 18. Layers & tags
- 21. Prefabs:
spawn&destroy
Physics
Bodies, collisions, and asking the world what is in front of you.
Input
Keyboard, mouse, and the action map.
Assets & materials
Models, textures, materials and data files, swapped while the game runs.
Animation, particles & sound
The three things that make a scene feel alive, driven from a script.
- 9. Animation:
node:animator() - 10. Particles:
node:particles() - 11. Audio:
audio.play,node:sound()& the mixer
Maths & the world
Vectors, terrain, water, scattered props, and orbital time.
- 19. Vectors & math:
vec3,vec2,distance - 22. Terrain:
terrain.sculpt,dig& queries - 22a. Water: volumes, buoyancy &
water.* - 22b. Scatter: thousands of props from a seed
- 25. Space: orbits, gravity & time-warp
Multiplayer
Replication, remote calls, rollback, and voice.
- 16. Networking:
net.*,synced,onRpc - 16b. Rollback netcode:
snapshot,restore&net.random - 16c. Voice: proximity chat
Data, time & the outside world
Saved games, timers, HTTP, the player's account, and the settings a game offers.
- 23. Saving:
save.set,save.get& slots - 24. Timers:
after,every&tween - 26. The web:
http.*&json.* - 27. The player's account:
account.* - 30. Settings a game offers its player:
app.*
Steam
Leaderboards, lobbies, and the overlay.
Working in the editor
The in-engine IDE, the profiler, the gotchas, and why some calls refuse.