InfiCode
InfiCode

Reputation: 1

What is wrong here? 'end' expected near '<eof>'

Playing around in a game engine right now and when trying to run the game I get this error.

Here's my code:

DrawText("Hello World!",1,1, DrawMode.Tile, "large",5)
function Draw()
RedrawDisplay()
PlaySong(0,false)
local speed = 5
local nextPos = 0
function Update(timeDelta)
nextPos = nextPos + (speed) * (timeDelta / 100)
function Draw()
RedrawDisplay()
DrawSprite(02, nextPos, 8)
end

Upvotes: 0

Views: 98

Answers (1)

Piglet
Piglet

Reputation: 28950

function Draw()

starts a function definition. It must be completed with an end to denote the end of its body.

like

function Draw()
  -- draw someting
end

Same for function Update(timeDelta)

I guess you're confusing function calls with function definitions.

Please read the Lua manual and do a beginners tutorial.

There is no point in editing and running code if you do not know the very basics of Lua.

Upvotes: 1

Related Questions