Page 1 of 1

Running multiple .lua files in a game?

Posted: Sat Aug 06, 2016 2:49 pm
by PiadinaAlexo
Hello, I'm new to Lua and Love2D, and basically I'm trying to make the "main menu" as the first thing,but basically since the main.lua file would be very long i wanted to make another .lua file, called "menu.lua". But when I run the entire folder, nothing happens: only black screen. How do I run the other file?

Re: Running multiple .lua files in a game?

Posted: Sat Aug 06, 2016 3:00 pm
by MadByte
Require files section
Read the PIL

Code: Select all

-- other.lua
function helloWorld()
  print("Hello World")
end


-- main.lua
require("other")
helloWorld() -- prints "Hello World" to the console

Re: Running multiple .lua files in a game?

Posted: Sat Aug 06, 2016 3:04 pm
by PiadinaAlexo
Thanks a lot! :awesome: