Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

main.lua:33: '<eof>' expected near 'end'
Started by chrisballas29 Dec 11 2019 11:15 AM

4 replies to this topic
lua
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

chrisballas29

[GLOBAL: userInfoPane.html]
chrisballas29
  • Observer

  • 1 posts
  • Corona SDK

local title = display.newText("Tic-Tac-Toe", display.contentCenterX25, native.systemFontBold20)

local leftVerticalLine = display.newRect (display.contentCenterX - 50, display.contentCenterY5300)
local rightVerticalLine = display.newRect (display.contentCenterX + 50, display.contentCenterY5300)
local topHorizontalLine = display.newRect (display.contentCenterX, display.contentCenterY - 503005)
local bottomHorizontalLine = display.newRect (display.contentCenterX, display.contentCenterY + 503005)

local spots = {}
local player = "X" --Player X always goes First

local funtion handleMove( event )
    if event.phase == "began" then
        if event.target.moveType == nil then
            if player == "X" then
                event.target.moveText.text = player
                event.target.moveType = player
                player = "O"
            else
                event.target.moveText.text = player
                event.target.moveType = player
                player = "X"
            end
        end
    end
    return true
end

for i = 19 do
    spots[i] = display.newRect(0090,90)
    spots[i]:setFillColor(0.20.20.2)
    spots[i].x = (i - 1) % 3 * 100 + 60
    spots[i].y = math.floor( (i - 1) / 3) * 100 + 140
    spots[i].moveText = display.newText(i, spots[i].x, spots[i].y, native.systemFontBold80)
    spots[i].moveType = nil
    spots[i]:addEventListener("touch", handleMove)
end

 

I have been trying to fix this for about an hour and i dont know why this happens the error is somewhere in the function but i dont know where



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,539 posts
  • Enterprise

It is likely that it's line 1. It's broken across multiple lines. You can't split individual Lua statements across multiple lines.

 

Rob



[TOPIC: post.html]
#3

Davy1222

[GLOBAL: userInfoPane.html]
Davy1222
  • Enthusiast

  • 42 posts
  • Corona SDK

It means you have too many "end"s around that line.

 

Edit: That's usually why I get the error but your reason is most likely what roaminggamer said down below. vvv



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,613 posts
  • Corona SDK

You've misspelled function.


  • pixec likes this

[TOPIC: post.html]
#5

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 102 posts
  • Corona SDK

lol, I just hate these kind of mistakes :D so simple but can take hours to figre out :D
  • AngelaMcCall likes this


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: lua