Jump to content




Window Error


  • You cannot reply to this topic
3 replies to this topic

#1 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 25 January 2015 - 04:15 AM

Hi there.

I am writing a display API for a few programs I am working on.
Problem is I can't even get the first function to work.

Here's the code I have so far:
local display = term
local tX, tY = display.getSize()

function centerAlign(text,y)
  display.setCursorPos(tX/2-#text/2,y)
  display.print(text)
end


Every time I run the function, I get the error window:248: bad argument: double expected, got nil

Can anyone tell me what's up?

#2 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 25 January 2015 - 04:21 AM

What are you passing into centerAlign? My guess is that you aren't passing in a y-value.

Edit: Also, term.print is not a thing

Edited by Bubba, 25 January 2015 - 04:23 AM.


#3 Quintuple Agent

  • Members
  • 107 posts
  • LocationThis page

Posted 25 January 2015 - 04:23 AM

Also print is not a term function, use write instead.

Edit: Curse you bubba!

Edited by Quintuple Agent, 25 January 2015 - 04:24 AM.


#4 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 25 January 2015 - 04:25 AM

All has been cleared up by the mighty Bubba. Thank you.

View PostQuintuple Agent, on 25 January 2015 - 04:23 AM, said:

Also print is not a term function, use write instead.

Edit: Curse you bubba!

Ah, yes, thank you.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users