Write a line the player can see
FIRST SCRIPT
This is the complete first_lua record. Read it from top to bottom. To see it run in your game, enter it in the new record’s code box.
local Script = {}function Script.run(context)
Log("The archive bell rang.")
await(ShowMessage({ text = "Someone is still in the archive.",
duration = 1.0 }))
return 42
endreturn ScriptRead it from top to bottom#
| local Script = {} | Make an empty table. Think of it as a folder for the things this script can do. |
|---|---|
| function Script.run | Define the job PCA3D starts when you run the record. The parentheses receive information about what started it. |
| Log(...) | Write a line for the game’s author to see in the output. |
| ShowMessage(...) | Give the player a message. The braces hold settings, including the text and its duration in seconds. |
| return 42 | Send the number 42 back to whoever called run. The player sees the message. A caller can use the number. |
| end / return Script | End the function, then hand the table of functions back to PCA3D. |
Keep the straight quotation marks when typing code. The two words in ShowMessage have capital S and M.
Lua scripting / Illustrated guide W05
