Including multiple files into the game/program

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
Divran
Prole
Posts: 12
Joined: Tue Mar 23, 2010 10:30 am

Including multiple files into the game/program

Post by Divran »

Hello. I have a quick question.
I have my main.lua file, but how do I include multiple lua files and have them run on load? It gets really messy with ALL the code in one single file.
Thanks.

EDIT:
I also have another question:
Several functions on the wiki state they have "modes". For example, the rectangle. The wiki does not give a list of all available modes, however. If you can tell me of a place where I can see all available modes of any function that has a "mode" argument, that would be great. If not, people who know all available modes should consider listing them in their corresponding function on the wiki.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Including multiple files into the game/program

Post by bartbes »

First question:
Check out the lua function require, it works almost the same in LÖVE, except the . syntax seems a little buggy... so you might want to use /. (that dot is not part of the replacement btw)

Second question:
"line" and "fill"
Divran
Prole
Posts: 12
Joined: Tue Mar 23, 2010 10:30 am

Re: Including multiple files into the game/program

Post by Divran »

bartbes wrote:Second question:
"line" and "fill"
That's only for one function. I meant ANY function that has a "mode" argument.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Including multiple files into the game/program

Post by bartbes »

AFAIK those are the modes for all of those functions.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Including multiple files into the game/program

Post by Robin »

Divran wrote:
bartbes wrote:Second question:
"line" and "fill"
That's only for one function. I meant ANY function that has a "mode" argument.
Click on the type of the mode. That gives you a list.
Help us help you: attach a .love.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Including multiple files into the game/program

Post by bmelts »

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Including multiple files into the game/program

Post by bartbes »

Oh, THOSE modes... aren't they all clickable?
Divran
Prole
Posts: 12
Joined: Tue Mar 23, 2010 10:30 am

Re: Including multiple files into the game/program

Post by Divran »

Robin wrote:
Divran wrote:
bartbes wrote:Second question:
"line" and "fill"
That's only for one function. I meant ANY function that has a "mode" argument.
Click on the type of the mode. That gives you a list.
Ah thanks. Didn't see that was a link.

And thanks, require worked.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests