Sublime Text 3 has stopped building main.lua files

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
MeepNaysh
Prole
Posts: 4
Joined: Sun Jul 26, 2020 9:43 pm

Sublime Text 3 has stopped building main.lua files

Post 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?
sphyrth
Party member
Posts: 260
Joined: Mon Jul 07, 2014 11:04 am
Contact:

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

Post by sphyrth »

Since it works on Notepad++, the problem probably lies in Sublime. It probably has new running configurations. Did you update it recently?
MeepNaysh
Prole
Posts: 4
Joined: Sun Jul 26, 2020 9:43 pm

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

Post 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.
MrFariator
Party member
Posts: 512
Joined: Wed Oct 05, 2016 11:53 am

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

Post 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.
MeepNaysh
Prole
Posts: 4
Joined: Sun Jul 26, 2020 9:43 pm

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

Post 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/"]
		}
	]
}
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

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

Post 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)
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
MeepNaysh
Prole
Posts: 4
Joined: Sun Jul 26, 2020 9:43 pm

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 83 guests