Jump to content




Button Api Help


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

#1 grand_mind1

  • Members
  • 207 posts

Posted 22 September 2013 - 02:03 AM

Button API:
http://pastebin.com/TmCR7bWX
Current code:
http://pastebin.com/vad3vses

I'm having problems with the sixth line where I say what the title is and what the color for the title should be. When I try the run the current code I get this error:
btn:55: Expected Number
This is where the computer sets the text color for the title. I've no idea why this would happen because I tell it to set the color to colors.white on line six.
Help is appreciated!
Thanks! :D

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 22 September 2013 - 02:19 AM

Line 65 calls title without specifying the color, which calls centerText without specifying a color. The error is thrown when centerText tries to set the text color to nil.

#3 grand_mind1

  • Members
  • 207 posts

Posted 22 September 2013 - 02:43 AM

Thanks! Also, in the fillTable function, when I tell it what function to run when it is clicked, is there any way to be able to have parameters passed to the function that it runs? If this requires more explanation please tell me.

#4 Apfeldstrudel

  • Members
  • 161 posts

Posted 22 September 2013 - 03:23 AM

I'm interested in an answer for this too.

#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 22 September 2013 - 12:22 PM

Yes, if they are known beforehand. Simply create an anonymous function to call the actual desired function:

function() return shell.run("argument") end

Notice that all this does is tail call another function with some arguments, but doesn't need any arguments passed to it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users