Invalid escape sequence near ""

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
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

Invalid escape sequence near ""

Post by MattyAB »

Hey Everyone,

I'v been trying to implement 'splashy' (https://github.com/karai17/splashy) - a graphical library for creating splash screens, but got the error

Code: Select all

Invalid escape sequence near ""
My main.lua looks like this - let me know if you need anything else. How can I stop this? am I just doing the formatting of the file path wrong?


Thanks!

Code: Select all

require "player"
require "camera"
splashy = require "\lib\splashy\init"

function love.load()
	player.load()
	
	splashy.drawn = 0
	electroSplash = love.graphics.newImage("\imgs\splash\electroSplash.png")
end

function love.update(dt)
	splashy.update(dt)
end

function love.draw()
	splashy.draw()
	
	--draw splash screen
	splashy.addSplash(electroSplash)
end
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Invalid escape sequence near ""

Post by ivan »

Lua strings cannot contain just "\" it has to be "\\".
Also, require works with "." instead of "\" or "/".
Lastly "\" is a Windows convention, for file paths we use "/"

Code: Select all

splashy = require "lib.splashy.init"

Code: Select all

   electroSplash = love.graphics.newImage("/imgs/splash/electroSplash.png")
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

Re: Invalid escape sequence near ""

Post by MattyAB »

Hmm... I'm getting the error "Module "lib.splashy.init" not found"

How can I fix this?

Thanks!
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
User avatar
unrecoverable
Prole
Posts: 4
Joined: Thu Nov 12, 2015 4:19 pm

Re: Invalid escape sequence near ""

Post by unrecoverable »

I believe with libraries that have an init.lua you want to require the folder itself.

So if that's the case, you'd want

Code: Select all

splashy = require "lib.splashy"
Give that a try and see if it works.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 207 guests