Page 1 of 1

cannot understand the error in this code

Posted: Thu Jul 02, 2020 10:03 am
by kanika456
push=require 'push'
WINDOW_WIDTH=1280
WINDOW_HEIGHT=720
VIRTUAL_WIDTH=432
VIRTUAL_HEIGHT=243
push:setupScreen(WINDOW_HEIGHT,WINDOW_WIDTH,VIRTUAL_HEIGHT,VIRTUAL_WIDTH,{fullscreen=true})
function love.draw()
push:apply('start')
love.graphics.printf('hello pong',0,VIRTUAL_HEIGHT/2-6,VIRTUAL_WIDTH,center)
push:apply('finish')
end


can someone tell me whats the problem in this?it is giving me errors while running it

Re: cannot understand the error in this code

Posted: Thu Jul 02, 2020 2:01 pm
by MadByte
Welcome to the forums.
Would be helpful to know the exact error message you got, keep it in mind next time.
What I can see is that you wrote center without "" (="center") to indicate it as string value which is needed for this argument.

Some more notes:
  • Make sure to use proper indention and spacing between values, this will help yourself and everyone who want's to help you with your future problems.
  • There is a "Support and Development" sub-forum which is more suitable for this kind of topics then the "General" sub-forum.

Re: cannot understand the error in this code

Posted: Thu Jul 02, 2020 7:41 pm
by pgimeno

Re: cannot understand the error in this code

Posted: Fri Jul 03, 2020 2:35 am
by sphyrth
Using the latest version of push.lua is the best advice we can give you.

I have to apologize. Everybody actually knows the drill. We're just tired of addressing it over and over again, although it's not your fault for following CS50.

Re: cannot understand the error in this code

Posted: Sat Jul 04, 2020 2:55 am
by hoistbypetard
sphyrth wrote: Fri Jul 03, 2020 2:35 am Using the latest version of push.lua is the best advice we can give you.

I have to apologize. Everybody actually knows the drill. We're just tired of addressing it over and over again, although it's not your fault for following CS50.
As someone who is wrapping up CS50's GD50, I'd give a slight twist to that advice... just use LOVE 0.10.2 for those class exercises where you start with code that the instructor wrote. push is the one that everyone posts here about, but there are other subtle things lurking in assorted other libraries the exercises bundle in, and none of the LOVE-based exercises really need anything that's in 11.3.

If you choose to use LOVE2D for your final project, it's worth moving to 11.3 and also grabbing the current versions of knife, push, etc. But it's not, IMO, worth getting the exercises to work right on 11.3 unless you're planning to base something more interesting on those exercises.