'require' not working in 0.8.0

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
runyonave
Prole
Posts: 27
Joined: Tue Dec 06, 2011 2:06 am

'require' not working in 0.8.0

Post by runyonave »

My game worked perfectly fine in 0.7.2, but trying to run it in 0.8.0 with requires on top doesn't work.

require 'maps/level1.lua'
require 'maps/level2.lua'
require 'lib/direction.lua'
require 'lib/hero.lua'
require 'lib/quad_make.lua'
require 'lib/game.lua'
require 'lib/Box_Map.lua'
require 'lib/box.lua'
require 'lib/stage.lua'
require 'lib/End_Points.lua'
require 'lib/Main_Menu.lua'
require 'lib/Pause_Menu.lua'
require 'conf.lua'
require 'config/debug.lua'

I get the following error from attachement.

It seems to be a problem only when using 'require'. I tested this out by making a simple game with a movable character and it works fine. But once I add in some 'require' files I get the error. I'm guessing 0.8.0 uses a different method to call in external lua files, but what?
Attachments
error_report.png
error_report.png (21.89 KiB) Viewed 3482 times
User avatar
Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

Re: 'require' not working in 0.8.0

Post by Puzzlem00n »

Just remove the .lua in all the requires. Should work.
I LÖVE, therefore I am.
User avatar
runyonave
Prole
Posts: 27
Joined: Tue Dec 06, 2011 2:06 am

Re: 'require' not working in 0.8.0

Post by runyonave »

Thanks that worked. Is there any other big change from 0.7.2 to 0.8.0? I know about pixel shaders but that anything else?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: 'require' not working in 0.8.0

Post by bartbes »

I'd like to take this moment to fix your requires more, the slashes should be replaced by dots.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: 'require' not working in 0.8.0

Post by Roland_Yonaba »

:o:

I didn't know that syntax was even working...

Code: Select all

require 'foo.lua'
Because, anytime I had to use require in the past, I used it without adding the '.lua'. I learned it that way... See require.

By the way, is there really a difference calling require with dots instead of slashes...?

Code: Select all

require 'folder.script'
require 'folder/script'
Is it related to the way OS filesystem paths are handled ? ...Fact is, I am working under Windows, and both of them works as well.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: 'require' not working in 0.8.0

Post by kikito »

Roland_Yonaba wrote:Is it related to the way OS filesystem paths are handled ? ...Fact is, I am working under Windows, and both of them works as well.
This:

Code: Select all

require 'folder.script'
is recommended and supported. That means it will always work in the future.

On the other hand this:

Code: Select all

require 'folder/script'
is not recommended. It works now, but it might not work in the future. This is what happened to runyonave; paths ending in .lua "worked", but where not supported or recommended. And then one day it stopped working.

So, the recommendation is using dots, not slashes.
When I write def I mean function.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: 'require' not working in 0.8.0

Post by Roland_Yonaba »

Very helpful.
Thanks.
User avatar
runyonave
Prole
Posts: 27
Joined: Tue Dec 06, 2011 2:06 am

Re: 'require' not working in 0.8.0

Post by runyonave »

Cool, thanks doe the replies. I'll make the changes later and test them. Did'nt know about using dots instead of slashes for file locations.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests