Conversation
Notices
-
:insane::insane::insane: I wonder where I should stop
- New Janny in Town likes this.
-
:insane:
-
think this is the closest I'll get to oop I enjoy in gay lua
> require "moon.all"
>
> class Moosesque
> new: (params) =>
> mixin_table self, params
> @name or= "Nameless"
> assert type(@name) == "string"
> @armor or= 0
> assert type(@armor) == "number"
>
> health = 100
> armor = 2
> guy = Moosesque{ :health, :armor }
> p guy
> -- {
> -- [health] = 100
> -- [armor] = 2
> -- [name] = "Nameless"
> -- }
>
> armor = "leather"
> badguy = Moosesque{ :health, :armor }
> -- moon: ./classtest.moon:9: (21) assertion failed!
> -- stack traceback:
> -- [C]: in function '__init'
> -- ./classtest.moon:9: (21) in function 'Moosesque'
> -- ./classtest.moon:21: (35) in main chunk
still no accessors you just rawdog it. maybe if I can figure out how to generate them...