Page 1 of 1

Invalid escape sequence near ""

Posted: Wed Nov 18, 2015 5:46 pm
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

Re: Invalid escape sequence near ""

Posted: Wed Nov 18, 2015 5:55 pm
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")

Re: Invalid escape sequence near ""

Posted: Wed Nov 18, 2015 11:13 pm
by MattyAB
Hmm... I'm getting the error "Module "lib.splashy.init" not found"

How can I fix this?

Thanks!

Re: Invalid escape sequence near ""

Posted: Fri Nov 20, 2015 3:46 pm
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.