Created
August 18, 2012 00:31
-
-
Save reefwing/3383637 to your computer and use it in GitHub Desktop.
Interlude 11 - Classes in Lua and Codea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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