Skip to content

Instantly share code, notes, and snippets.

@reefwing
Created August 18, 2012 00:31
Show Gist options
  • Save reefwing/3383637 to your computer and use it in GitHub Desktop.
Save reefwing/3383637 to your computer and use it in GitHub Desktop.
Interlude 11 - Classes in Lua and Codea
MyClass = class()
function MyClass:init(x)
-- you can accept and set parameters here
self.x = x
end
function MyClass:draw()
-- Codea does not automatically call this method
end
function MyClass:touched(touch)
-- Codea does not automatically call this method
end
Ship = class()
function Ship:init(x)
-- you can accept and set parameters here
self.x = x
end
function Ship:draw()
-- Codea does not automatically call this method
end
function Ship:touched(touch)
-- Codea does not automatically call this method
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment