This file contains hidden or 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
| local interface Animal | |
| -- Associated function signature; `Self` refers to the implementor type. | |
| new: function(string): self | |
| -- Method signatures; these will return a string. | |
| name: function(self): string | |
| noise: function(self): string | |
| talk: function(self) | |
| end |
This file contains hidden or 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
| local record Sheep | |
| _naked: boolean | |
| _name: string | |
| __index: Sheep | |
| end | |
| Sheep.__index = Sheep | |
| -- impl Sheep | |
| function Sheep:shear() | |
| print(self._name, "gets a haircut!"); |