Getting started
Install Luma
Luma is one program, luma, with nothing else to install.
On Linux and macOS, one command downloads it, checks it and installs it:
curl -fsSL https://luma-lang.com/install.sh | shOr do it yourself:
- Download it for your system from the Downloads page.
- Unpack it and put
lumaon yourPATH. - Check that it answers:
luma helpYour first program
Create a file called hello.luma:
print("Hello World")Output:
Hello WorldRun it
luma run hello.lumarun reads the program and runs it immediately in the Luma interpreter. No file is created. This is the quickest way to try things out.
Build it
luma build hello.luma
./hellobuild compiles the program into a native executable called hello. You can copy it to another computer with the same operating system and run it there; Luma doesn’t need to be installed.
The executables are small (a few kilobytes) and depend on nothing but the operating system:
- On Linux the program talks to the kernel directly.
- On Windows it uses only
kernel32.dll, which every Windows installation has.
To build a Windows program from Linux (or the other way around), choose the target:
luma build hello.luma -target windows # creates hello.exeSee The luma command for all options.
Run or build?
luma run | luma build | |
|---|---|---|
| Starts | immediately | after compiling (a fraction of a second) |
| Creates a file | no | yes, an executable |
| Needs Luma to run | yes | no |
| Output | identical | identical |
The two modes are designed to give exactly the same results, including number formatting and error messages. Use run while writing a program and build when you want to share or install it.
A slightly bigger program
// Grades for a few scores
scores: [int] = [91, 78, 64]
names: [str] = ["Ada", "Bjarne", "Guido"]
best: int = scores[0]
if scores[1] > best {
best = scores[1]
}
if scores[2] > best {
best = scores[2]
}
print("Best score:")
print(best)
average: float = (91.0 + 78.0 + 64.0) / 3.0
print(average)
print(names)Output:
Best score:
91
77.66666666666667
["Ada", "Bjarne", "Guido"]Next steps
- This manual is also built into
luma:luma doclists its pages and topics,luma doc walkshows one, andluma doc -s wordsearches it (see thelumacommand). - Learn the rules of the language, starting with Basics.
- Check Limitations to see what isn’t available yet. For example, a function can’t yet be passed to another function.