Skip to content

First Program

Martin S. edited this page Oct 9, 2026 · 1 revision

First program.

  • Create new folder
  • Inside this folder create your main project definition name.lunx (can be main.lunx, project.lunx etc.)
  • Clone reporsitory.
  • Open terminal in (Repository Name) {Path}\RepositoryName
  • Run: lua Lunx.lua {Path}.lunx -nf -ht
    • Lunx.lua is in the repository and that will run the .lunx project.

.lunx file

What is it?

It is main definition of Lunacity project where behaviour of project is defined.

  • No comments can be defined.

Structure:

  • Include and depend have to be after enter and before output
  • Depend can be before include and include can be before depend, no order is needed with them.
project file
enter file
<include file, depend file>
output file

Project keyword:

  • Defines new project (name is supposed to be replaced by your own name of project)
project name

Enter keyword:

  • Defines entry point of object that will have static method (without parameters & no return value) with attribute [EntryPoint], that will be executed.
  • name is supposed to be replaced by your own file with extension.lun. (Can be called EntryPoint.lun, Entry.lun etc.)
enter name.lun

Output keyword:

  • Defines output .lua file.
  • name is supposed to be replaced by your own output .lua file. (Can be Output.lua or anything else)
output name.lua

Include keyword:

  • Defines, which .lun files should be included in your project.
  • name ...
include name.lun

Depend keyword:

  • Defines projects that this project is dependent on and uses their modules.
  • name yes replace it!
depend name.lun

Exmaple

📁 FirstLunProject

  • 📄 Main.lunx
  • 📄 EntryPoint.lun
  • 📄 Output.lua

Main.lunx:

project FirstLunProject
enter EntryPoint.lun
into Output.lua

EntryPoint.lun:

module Test:
    public static class MyEntry:
        [EntryPoint]
        public static method PrintHello():
            Output.Print("Hello World!")
        end
    end
end

Clone this wiki locally