Install and first program

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 | sh

Or do it yourself:

  1. Download it for your system from the Downloads page.
  2. Unpack it and put luma on your PATH.
  3. Check that it answers:
luma help

Your first program

Create a file called hello.luma:

print("Hello World")

Output:

Hello World

Run it

luma run hello.luma

run 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
./hello

build 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.exe

See The luma command for all options.

Run or build?

luma runluma build
Startsimmediatelyafter compiling (a fraction of a second)
Creates a filenoyes, an executable
Needs Luma to runyesno
Outputidenticalidentical

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 doc lists its pages and topics, luma doc walk shows one, and luma doc -s word searches it (see the luma command).
  • 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.