public
Description: obj-c <=> lua bridge for iPhone!
Homepage: Coming Soon!
Clone URL: git://github.com/probablycorey/wax.git
wax /
name age message
file .gitignore Wed Aug 26 16:10:06 -0700 2009 added a garbage collection example... was using... [probablycorey]
file FAQ Tue Nov 10 08:49:37 -0800 2009 pre-fix [probablycorey]
file LICENSE Thu Oct 01 09:14:40 -0700 2009 updated readme, added license [probablycorey]
file README.md Thu Oct 15 12:52:21 -0700 2009 updated readme [probablycorey]
directory examples/ Tue Nov 10 08:49:37 -0800 2009 pre-fix [probablycorey]
directory lib/ Tue Dec 01 08:01:26 -0800 2009 added new enums and string extensions [probablycorey]
file rakefile Thu Oct 15 17:34:44 -0700 2009 updated xcode templates [probablycorey]
directory xcode-template/ Tue Dec 01 16:24:38 -0800 2009 added all UITextTraits to WaxTextField [probablycorey]
README.md

Setup

  1. Download wax http://github.com/probablycorey/wax

  2. From the inside the wax folder type rake install. This will install an xcode project template.

  3. Open up xcode and create a new Wax project, it should be located under the User Tempates section.

  4. Build and Run! You've got lua running on the iPhone!

  5. Check MobileOrchard.com's Wax tutorial!

Example

Simple UITableViewController Example

waxClass{"BasicTableViewController", "UITableViewController", protocols = {"UITableViewDelegate", "UITableViewDataSource"}}

function init(self)
  self.super:init()
  self.states = {"Michigan", "California", "New York", "Illinois", "Minnesota", "Florida"}
  return self
end

function viewDidLoad(self)
  self:tableView():setDataSource(self)
  self:tableView():setDelegate(self)
end

-- DataSource
-------------
function numberOfSectionsInTableView(self, tableView)
  return 1
end

function tableView_numberOfRowsInSection(self, tableView, section)
  return #self.states
end

function tableView_cellForRowAtIndexPath(self, tableView, indexPath)  
  local identifier = "BasicableViewCell"
  local cell = tableView:dequeueReusableCellWithIdentifier(identifier)
  cell = cell or UI.TableViewCell:initWithStyle_reuseIdentifier(UITableViewCellStyleDefault, identifier)  

  cell:setText(self.states[indexPath:row() + 1]) -- Must +1 because lua arrays are 1 based

  return cell
end

-- Delegate
-----------
function tableView_didSelectRowAtIndexPath(self, tableView, indexPath)
  self:tableView():deselectRowAtIndexPath_animated(indexPath, true)
  -- Do something cool here!
end

Created By

Corey Johnson (probablycorey at gmail dot com)

More