Skip to content

Getting started

ACharLuk edited this page Jan 21, 2018 · 1 revision

Installation

  • Download Visual Studio Code
  • Get the Luna extension from VS Code or from here
  • Open a folder, press F1 and select Create a Luna project

Introduction

  • There are two main functions in Luna: setup, which runs only once, and render, which runs every frame until you close the window.

  • The first Luna function you need to know is size. It has three parameters: The width of the window, the height of the window and finally its title. You can only run this function once.

  • The second function you must know is clear. This is a really simple function with no parameters that clears the screen. You should use it every time you want to render a new frame.

Start coding!

  • Create a file called main.lua with this code:
function setup()
    size(1280, 720, "My first Luna app!")
end

function render()
    clear()
end
  • Press F12 (Cmd+R in MacOS if F12 doesn't work), this will save the file and run Luna for you with the currently opened file
  • You should see a black window with the dimensions and the title you have set: Getting started

Note (Windows): If you see an error message showing that MSVCP140.dll is missing, install this: Visual C++ Redistributable for Visual Studio 2015 (x86)


  • Well done! You created your very first Luna application!

Next step:

Clone this wiki locally