1

Ok, so i've made a game using love2D and I tried converting it into a .app, because i'm running Mac OSX. But I got the error saying that main.lua needs to be that the top level of the .zip. So I tried putting all of my lua scripts into a folder leaving only the main.lua and the conf.lua in the top level of the .zip. But now love2D cannot find the other files in the folder. I tried putting the name of the directory when using "require." for instance:

    require "dir/player.lua"

but that wouldn't work...

1 Answer 1

2

Use

require "dir.player"

The dot . denotes a parent level, the .lua is not needed.

Sign up to request clarification or add additional context in comments.

2 Comments

This works for require. Is there a way to provide a platform independent directory to other functions? Say I have a .wav file I want to load through love.audio.newSource and it is in sound folder. In Windows the obvious way to go is sound = love.audio.newSource('sound/file.wav'). How to make dir cross-platform?
Well, i'm not sure about this, but i'm on linux and i would use the exact same syntax. What exactly is platform dependent in this line? I would say it depends on the handling of paths of love, especially in this case its audio loading routine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.