How can I use multiple files?

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
User avatar
guy
Prole
Posts: 11
Joined: Wed Sep 19, 2018 7:10 pm

How can I use multiple files?

Post by guy »

So I have a main.lua with nothing in it, and a player.lua which is just a rectangle with user input. And none of the tutorials I've seen so far have helped. How can I call player.lua into the main.lua?
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

Re: How can I use multiple files?

Post by Nikki »

You require it.

Code: Select all

require 'player' 
This will just include that file, you can also do

Code: Select all

Player = require 'player'
Here is the tutorial chapter about this
http://sheepolution.com/learn/book/9
Post Reply

Who is online

Users browsing this forum: baconhawka7x and 48 guests