Sublime Text isn't working with Love

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
Juice_Box
Prole
Posts: 5
Joined: Fri Oct 31, 2014 12:06 am

Sublime Text isn't working with Love

Post by Juice_Box »

I know this question has been asked about a million times, but I can't find a fix (at all) for this. I'm trying to make a build system in Sublime Text 2 for love but I keep on getting the same error,

Code: Select all

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
The code that i have entered is the default build system listed at the site http://love2d.org/wiki/Sublime_Text_2
[Note that my OS is Windows 7]

I hope that I'm not posting this in the wrong section at all, but if I am, then sorry. This is my first post on the forum :|
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Sublime Text isn't working with Love

Post by s-ol »

Juice_Box wrote:I know this question has been asked about a million times, but I can't find a fix (at all) for this. I'm trying to make a build system in Sublime Text 2 for love but I keep on getting the same error,

Code: Select all

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
The code that i have entered is the default build system listed at the site http://love2d.org/wiki/Sublime_Text_2
[Note that my OS is Windows 7]

I hope that I'm not posting this in the wrong section at all, but if I am, then sorry. This is my first post on the forum :|
The problem is that there's a space in the path. Add your love install location to the PATH environment variable (google it), then set this as the build system:

Code: Select all

{
    "selector": "source.lua",
    "cmd": ["love", "${project_path:${file_path}}"],
    "shell": true,
    "file_regex": "^Error: (?:[^:]+: )?([^: ]+?):(\\d+):() ([^:]*)$"
}
or even better, install the "LuaLove" package and modify the build system (C:\Users\....\AppData\Roaming\Sublime Text 2\Packages\Lua Love\LuaLove.sublime-build) to look like this:

Code: Select all

{
	"file_regex": "^(?:(?:\t)|(?:.+: ))(.+):([0-9]+): (.*)$",
	"selector": "source.lua",
	"shell": true,
	"cmd": ["love", "${project_path:${file_path:.}}"],

	"variants": [
		{
			"name": "Love2D",
			"shell": true,
			"cmd": ["love", "${project_path:.}"],
			"osx":
			{
				"cmd": ["love $project_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/"]
		}
	]
}
I also updated the wiki with this information.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Juice_Box
Prole
Posts: 5
Joined: Fri Oct 31, 2014 12:06 am

Re: Sublime Text isn't working with Love

Post by Juice_Box »

S0lll0s wrote:
Juice_Box wrote:I know this question has been asked about a million times, but I can't find a fix (at all) for this. I'm trying to make a build system in Sublime Text 2 for love but I keep on getting the same error,

Code: Select all

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
The code that i have entered is the default build system listed at the site http://love2d.org/wiki/Sublime_Text_2
[Note that my OS is Windows 7]

I hope that I'm not posting this in the wrong section at all, but if I am, then sorry. This is my first post on the forum :|
The problem is that there's a space in the path. Add your love install location to the PATH environment variable (google it), then set this as the build system:

Code: Select all

{
    "selector": "source.lua",
    "cmd": ["love", "${project_path:${file_path}}"],
    "shell": true,
    "file_regex": "^Error: (?:[^:]+: )?([^: ]+?):(\\d+):() ([^:]*)$"
}
or even better, install the "LuaLove" package and modify the build system (C:\Users\....\AppData\Roaming\Sublime Text 2\Packages\Lua Love\LuaLove.sublime-build) to look like this:

Code: Select all

{
	"file_regex": "^(?:(?:\t)|(?:.+: ))(.+):([0-9]+): (.*)$",
	"selector": "source.lua",
	"shell": true,
	"cmd": ["love", "${project_path:${file_path:.}}"],

	"variants": [
		{
			"name": "Love2D",
			"shell": true,
			"cmd": ["love", "${project_path:.}"],
			"osx":
			{
				"cmd": ["love $project_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/"]
		}
	]
}
I also updated the wiki with this information.
I did the LuaLove thing, and set up everything(I didn't set up the environment variable,) I changed the environment var. part to

Code: Select all

"cmd": ["C:\"Program Files (x86)\"LOVE\"love.exe", "${project_path:${file_path:.}}"],
I don't know if i did something wrong, but when i build (even when i build a project with the "hello world" code in it) it just opens up love with no game.. At least it actually opens love now.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Sublime Text isn't working with Love

Post by s-ol »

Make sure the file is called main.lua. Also that cmd string looks really weird, but if it works go ahead and keep it.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Juice_Box
Prole
Posts: 5
Joined: Fri Oct 31, 2014 12:06 am

Re: Sublime Text isn't working with Love

Post by Juice_Box »

S0lll0s wrote:Make sure the file is called main.lua. Also that cmd string looks really weird, but if it works go ahead and keep it.
the file is infact called main.lua. and is in its own folder
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Sublime Text isn't working with Love

Post by s-ol »

Juice_Box wrote:
S0lll0s wrote:Make sure the file is called main.lua. Also that cmd string looks really weird, but if it works go ahead and keep it.
the file is infact called main.lua. and is in its own folder

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 213 guests