Error in Lua with LOVE2D

Asked

Viewed 60 times

0

I’m having a problem with a code in Lua with LOVE2D. I’m trying to recreate the "game of the little snake" and I have a problem with the setupScreen function in love.load The code is like this:

WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720

VIRTUAL_WIDTH = 432
VIRTUAL_HEIGHT = 243

function love.load()
push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT {
    fullscreen = false,
    resizable = true,
    vsync = true
})

I’ve used the same code before and never had problems, but now when I run with love appears: main.lua.29: Attempt to call global 'WINDOW_HEIGHT' (a number value)

In the editor, for some reason, the 'WINDOW_HEIGHT' is the same color 'setupscreen' of the same line (line 7 in this question). Please, if anyone could help, I would be most grateful!

  • This code does not compile. Missing end. With that fixed, there’s this mistake: attempt to index global 'push'.

1 answer

-2

Hello, good night. The error here is very simple and common. It’s just missing a simple comma after the WINDOW_HEIGHT. Follow the code

function love.load()
    push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT,{
    fullscreen = false,
    resizable = true,
    vsync = true
})
end

Pretty simple, huh? I hope I helped.

Edit: I made a small mistake in the code, but already fix. Sorry for the inconvenience!

Bons Códigos :)

ASS.: Marcosdev

Browser other questions tagged

You are not signed in. Login or sign up in order to post.