Last active
February 9, 2016 18:28
-
-
Save kidapu/19b475c65f0c9c6a1e9c to your computer and use it in GitHub Desktop.
the way to require class in moonscript. http://www.luafaq.org/#T8.1.5
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
test = require "test" | |
t = test.TestClass() | |
t\update() | |
t\print() | |
print t.val | |
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
G = {} | |
class TestClass | |
new: => | |
@aa = 0 | |
@val = 100 | |
update: => | |
@aa += 1 | |
@aa | |
print: => | |
print @aa | |
G.TestClass = TestClass | |
return G |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment