Page 1 of 1

Sublime Text 3 has stopped building main.lua files

Posted: Sun Jul 26, 2020 10:00 pm
by MeepNaysh
I am trying to complete the edX games50 course, and I recently started it again after putting it down for about a month. A month ago, Sublime text 3 worked perfectly, now, for a reason I cannot understand, it won't build. I've tested the files with notepad++ and they run perfectly, but notepad++ hurts my eyes. The error I'm receiving is this:

Error

boot.lua:433: No code to run
Your game might be packaged incorrectly
Make sure main.lua is at the top level of the zip

Traceback

[C]: in function 'error'
[C]: in function 'xpcall'

I don't understand why I'm receiving this message now, since it worked a month ago and nothing has changed. The files also are not packaged in a zip, and main.lua is in the top level of the folder. It's really frustrating me. I did try packaging the files as a love executable and it worked fine then as well. The problem seems to be with Sublime Text 3. How can I get rid of this error?

Re: Sublime Text 3 has stopped building main.lua files

Posted: Mon Jul 27, 2020 1:26 am
by sphyrth
Since it works on Notepad++, the problem probably lies in Sublime. It probably has new running configurations. Did you update it recently?

Re: Sublime Text 3 has stopped building main.lua files

Posted: Mon Jul 27, 2020 3:22 am
by MeepNaysh
sphyrth wrote: Mon Jul 27, 2020 1:26 am Since it works on Notepad++, the problem probably lies in Sublime. It probably has new running configurations. Did you update it recently?
I don't recall an update. I did try reinstalling it and the lua love package, but that was after the problem had already started.

Re: Sublime Text 3 has stopped building main.lua files

Posted: Mon Jul 27, 2020 6:27 pm
by MrFariator
Sublime might be pointing to wrong destination folder when you run the build command, so I recommend checking the build system you are using to run löve.

Re: Sublime Text 3 has stopped building main.lua files

Posted: Tue Jul 28, 2020 12:00 am
by MeepNaysh
MrFariator wrote: Mon Jul 27, 2020 6:27 pm Sublime might be pointing to wrong destination folder when you run the build command, so I recommend checking the build system you are using to run löve.
I opened up the build system, but I have no idea how to decipher this. Can anyone translate, or suggest what the problem might be based on this?

This is also just the automatically installed lua love build system; I didn't change it.

Code: Select all

{
	"file_regex": "^(?:(?:\t)|(?:.+: ))(.+):([0-9]+): (.*)$",
	"selector": "source.lua",
	"cmd": ["lua", "$file"],

	"variants": [
		{	"name": "Run",
			"cmd": ["luajit", "$file"]
		},
		{	"name": "Love2D",
			"shell": true,
			"cmd": ["love", "${project_path:${folder:${file_path}}}"],
			"osx":
			{
				"cmd": ["love ${project_path:${folder:${file_path}}}"]
			}
		},
		{   "name": "ldoc: File",
			"shell": true,
			"cmd": ["ldoc -d $project_path/doc/$file_base_name -f markdown -t $file_base_name $file"]
		},
		{   "name": "ldoc: Project",
			"shell": true,
			"cmd": ["ldoc -d $project_path/doc -f markdown -t $project_base_name $project_path/src/"]
		}
	]
}

Re: Sublime Text 3 has stopped building main.lua files

Posted: Tue Jul 28, 2020 2:41 pm
by ReFreezed
This is assuming you use the "Love2D" variant in that build system... (also, I may be over-explaining things a bit)

The "${project_path:${folder:${file_path}}}" string is the important part when Sublime tries to launch LÖVE. As you may know, to run a LÖVE game you give love.exe (here, simply "love") the path to a .love file, or the path to a folder with main.lua, as its argument. The string here uses "variables" that gets replaced by Sublime when you run the build system. ${project_path:xxx} will get replaced by the path to the folder containing the current project file. If you're not using the project functionality in Sublime then that variable will be empty and you'll get the value of xxx instead (as a fallback value). In this string that value is ${folder:xxx} which is yet another variable (with another fallback) and so on...

Basically, if you're using the project functionality in Sublime then your main.lua should be in same folder as the .sublime-project file. If not, then you'll need the focused tab to be either main.lua or another file in the same folder (indicated by ${file_path} in the string) for the build system to work.

(See the docs for more info)

Re: Sublime Text 3 has stopped building main.lua files

Posted: Tue Jul 28, 2020 11:41 pm
by MeepNaysh
ReFreezed wrote: Tue Jul 28, 2020 2:41 pm This is assuming you use the "Love2D" variant in that build system... (also, I may be over-explaining things a bit)

The "${project_path:${folder:${file_path}}}" string is the important part when Sublime tries to launch LÖVE. As you may know, to run a LÖVE game you give love.exe (here, simply "love") the path to a .love file, or the path to a folder with main.lua, as its argument. The string here uses "variables" that gets replaced by Sublime when you run the build system. ${project_path:xxx} will get replaced by the path to the folder containing the current project file. If you're not using the project functionality in Sublime then that variable will be empty and you'll get the value of xxx instead (as a fallback value). In this string that value is ${folder:xxx} which is yet another variable (with another fallback) and so on...

Basically, if you're using the project functionality in Sublime then your main.lua should be in same folder as the .sublime-project file. If not, then you'll need the focused tab to be either main.lua or another file in the same folder (indicated by ${file_path} in the string) for the build system to work.

(See the docs for more info)
Thanks for the explanation! Unfortunately, I've already been trying to launch it with the focused tab as the main.lua file. I might try the other method you describe, but I've since installed Atom, and it's been working fine, and unlike notepad++ it doesn't hurt my eyes. If anyone else has an idea, they're free to post them but I don't think it's necessary any longer.