Page 1 of 1

getting : boot.lua:481: Cannot load game at path in windows

Posted: Wed May 16, 2018 7:00 pm
by umen
Hello all
i compile the engine and try to load simple lua script but i keep getting

Code: Select all

Error

boot.lua:481: Cannot load game at path 'D:/Dev/my/cpp/2d/love2d/main.lua'.
Make sure a folder exists at the specified path.


Traceback

[C]: in function 'error'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Im using visual studio 2017
as you can see the file exist
the file in the path
the file in the path
Capture.PNG (63.27 KiB) Viewed 7285 times


also in VS i defined the file like this :
vs config
vs config
Capture2.PNG (121.33 KiB) Viewed 7285 times
what can be the problem ?
where to debug and check why the file doesn't load ?

Thanks

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Wed May 16, 2018 7:05 pm
by zorg
"Make sure a folder exists at the specified path."
Folder, not file.
You want D:\Dev\my\cpp\2d\love2d\ instead of D:\Dev\my\cpp\2d\love2d\main.lua

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 6:33 am
by umen
Thanks it is working I thought it need the main.lua file as arg , how does it know what lua file to load ?

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 6:40 am
by raidho36
It always loads the main.lua file.

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 7:20 am
by zorg
Just like with C and a lot of other languages, might i add; main is usually the entrypoint.

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 7:37 am
by umen
i dont know lua , but in C / java / what ever you dont need your file named "main"
the entry point only is "main"
what if i want my game file called "myGame.lua"?

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 8:06 am
by NotARaptor
A completed project will contain several .lua files, and it needs to be able to determine which is the entry point. Remember that a .love file is actually a .zip containing all the source files and resources. Love2d does this by specifying that the file called "main.lua" is the entry point.

In C it's slightly different - each .c file is compiled to a .obj file by the compiler, and then linked together by the linker - the linker finds which .obj file contains the "main" function and makes that the entrypoint. The Love2d/Lua system can't possibly work like this - for one thing you could have two different .lua files that each define a function of the same name! If you tried this in C, it would barf at the linker stage.

So, to sum up... the FOLDER is what Love2d sees as the "application" (whether it's zipped or not), and the main.lua file is the entry point.

I use Windows too (cue the "booo!" sounds), but prefer working with a flat text editor rather than an IDE. So I fired up regedit and added an entry to the directory background context menu, and the directory object context menu to run the folder with Love2d. So I just right-click in the background of the Windows Explorer and select "Run with Love2d" and it runs the project... simple.

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 8:53 am
by umen
all good thanks!
im more into checking the love2d infra , less how lua works

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 8:55 am
by zorg
umen wrote: Thu May 17, 2018 7:37 am i dont know lua , but in C / java / what ever you dont need your file named "main"
the entry point only is "main"
what if i want my game file called "myGame.lua"?
Then you'd name your love file (which is a zip) myGame.love
NotARaptor wrote: Thu May 17, 2018 8:06 am So, to sum up... the FOLDER is what Love2d sees as the "application" (whether it's zipped or not), and the main.lua file is the entry point.
One thing though, you zip up the contents of the folder, not the folder itself.

Re: getting : boot.lua:481: Cannot load game at path in windows

Posted: Thu May 17, 2018 9:06 am
by NotARaptor
zorg wrote:One thing though, you zip up the contents of the folder, not the folder itself.
Good point!