Begineer: How do you insert a library
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Begineer: How do you insert a library
I've noticed people create libraries to help with game development in Love2D? I know this is a stupid question but how do you include it via lua. Is it something like include "blah.lua"?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Begineer: How do you insert a library
It's usually require.
The '.lua' part is added automatically if you don't add it.
Sooner or later you will start adding folders. Then you can do
Edit: Note that require only works 'the first time'. If for some reason you need to include the same file more than once, you can use dofile instead.
Code: Select all
require 'blah.lua'
Sooner or later you will start adding folders. Then you can do
Code: Select all
require 'afolder.asubfolder.blah'
When I write def I mean function.
Re: Begineer: How do you insert a library
Thanks Kikito, truly appreciated
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Begineer: How do you insert a library
Actually, you can't, use love.filesystem.load("<filename>")().kikito wrote: you can use dofile instead.
Who is online
Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 18 guests