widget.newButton() Not Working

I have a basic example in my main.lua and and get this error…

2013-01-18 17:24:16.954 Corona Simulator[41493:707] Runtime error
?:0: attempt to index a nil value
stack traceback:
[C]: ?
?: in function ‘newButton’
/Users/mkjt88/Downloads/Pong/main.lua:3: in main chunk
2013-01-18 17:24:16.955 Corona Simulator[41493:707] Runtime error:
2013-01-18 17:24:16.956 Corona Simulator[41493:707] ?:0: attempt to index a nil value
stack traceback:
[C]: ?
?: in function ‘newButton’
/Users/mkjt88/Downloads/Pong/main.lua:3: in main chunk

[lua]local widget = require “widget”

local button = widget.newButton()
button.x = display.contentWidth * 0.5
button.y = display.contentHeight * 0.5 [import]uid: 20272 topic_id: 35090 reply_id: 335090[/import]

  1. It probably needs some minimum values passed in the brackets. What happens if you try this?

local button = widget.newButton{ label = "button", cornerRadius = 8 }

(Yes, those are {} not () )

  1. There is a shortcut for those coordinates:

button.x = display.contentCenterX button.y = display.contentCenterY [import]uid: 41884 topic_id: 35090 reply_id: 139530[/import]

local widget = require "widget"  
  
local button = widget.newButton{  
 id = "btn001",  
 left = display.contentWidth \* 0.5,  
 top = display.contentWidth \* 0.5,  
 label = "My Button",  
 width = 100, height = 30,  
 cornerRadius = 8,  
 onEvent = onButtonEvent  
}  

Widget have additional options.
Refer here, http://docs.coronalabs.com/api/library/widget/newButton.html

[import]uid: 74883 topic_id: 35090 reply_id: 139531[/import]

Wow thanks richard i just had the syntax wrong… had () instead of {}. And nice link Burhan I know see there are many more requirements. [import]uid: 20272 topic_id: 35090 reply_id: 139533[/import]

  1. It probably needs some minimum values passed in the brackets. What happens if you try this?

local button = widget.newButton{ label = "button", cornerRadius = 8 }

(Yes, those are {} not () )

  1. There is a shortcut for those coordinates:

button.x = display.contentCenterX button.y = display.contentCenterY [import]uid: 41884 topic_id: 35090 reply_id: 139530[/import]

local widget = require "widget"  
  
local button = widget.newButton{  
 id = "btn001",  
 left = display.contentWidth \* 0.5,  
 top = display.contentWidth \* 0.5,  
 label = "My Button",  
 width = 100, height = 30,  
 cornerRadius = 8,  
 onEvent = onButtonEvent  
}  

Widget have additional options.
Refer here, http://docs.coronalabs.com/api/library/widget/newButton.html

[import]uid: 74883 topic_id: 35090 reply_id: 139531[/import]

Wow thanks richard i just had the syntax wrong… had () instead of {}. And nice link Burhan I know see there are many more requirements. [import]uid: 20272 topic_id: 35090 reply_id: 139533[/import]