Last active
February 9, 2016 18:26
-
-
Save kidapu/4fab5484155649b67290 to your computer and use it in GitHub Desktop.
the way to require class in moonscript (this syntax is depreciated)
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
require "test" | |
a = test.AClass() | |
a\update() | |
a\update() | |
a\print() |
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
module "test", package.seeall | |
export AClass | |
class AClass | |
new: => | |
@aa = 0 | |
update: => | |
@aa += 1 | |
@aa | |
print: => | |
print @aa |
ありがとうございます。近い記事を見つけました。 https://coronalabs.com/blog/2011/09/05/a-better-approach-to-external-modules/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
module
は Lua 5.2 で deprecated になってるので、こっちの手法で http://www.luafaq.org/#T8.1.5