Running multiple .lua files in a game?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
PiadinaAlexo
Prole
Posts: 8
Joined: Sat Aug 06, 2016 2:41 pm

Running multiple .lua files in a game?

Post 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?
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Running multiple .lua files in a game?

Post 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
PiadinaAlexo
Prole
Posts: 8
Joined: Sat Aug 06, 2016 2:41 pm

Re: Running multiple .lua files in a game?

Post by PiadinaAlexo »

Thanks a lot! :awesome:
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests