Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

obj-c <=> lua bridge for iPhone!

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 xcode-template
Octocat-spinner-32 .gitignore
Octocat-spinner-32 FAQ
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 rakefile
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

Something went wrong with that request. Please try again.