It makes no sense[solved]
Posted: Mon Feb 27, 2023 4:09 am
Hi,
Today I was working on my code but when I executed it gave me a strange error:
here is the code:
Hope you guys will help me !
Today I was working on my code but when I executed it gave me a strange error:
Code: Select all
--the error
Error
Syntax error: libs/sav.lua:16: '=' expected near 'love'
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x7ffeecd331d0
[C]: in function 'require'
main.lua:3: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Code: Select all
l = {}
function l.load(file)
if love.filesystem.getInfo(file) then
return(love.filesystem.read(file))
else
love.filesystem.newFile(file)
love.filesystem.write(file, 0)
return(love.filesystem.read(file))
end
end
function l.save(val, file)
if love.filesystem.getInfo(file) then
love.filesystem.write(file, val)
else
l.load
love.filesystem.write(file, val)
end
end