''end' expected near '<eof>' for map import for lua file

Error

Syntax error: main.lua:8: 'end' expected (to close 'function' at line 5) near '<eof>'
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x010558a810
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

I am getting the above error when I am trying to import a game map for my love2D game. My code is below:

function love.load()
    sti = require'lib/sti'
    gameMap = sti('Maps/test_map.lua')
end

function love.draw()
    gameMap:draw()
end

sti is a library which I am using to get the map into love. I learnt this from a youtube tutorial.



Solution 1:[1]

try looking at the function gameMap:draw, you might have forgotten an end on it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 freeve4