This repository has been archived by the owner on May 7, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
425 additions
and
207 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class Person: Object | ||
|
||
property isMale: Boolean? -- allows nil | ||
property age: Number = 0 | ||
property firstName: String | ||
property lastName: String | ||
property language: Language.Type = EnglishLanguage.self -- .Type means that rather than being an instance, the vaule has to be the class/static itself (or a subclass' class/static) | ||
|
||
default otherThing = "One" -- overwrite the default value defined in a superclass | ||
|
||
function initialise(firstName: String = "John", lastName: String = "Smith", isMale: Boolean) | ||
-- anything here would need to support valid Lua | ||
-- i.e. if you paste in vanilla Lua it'd work normally | ||
-- this part is still statically typed though | ||
local blah = "this" -- type = Any? | ||
local num: Number = 4 -- this must be a number wherever its used | ||
|
||
self.firstName = firstName | ||
self.lastName = lastName | ||
self.isMale = isMale | ||
end | ||
|
||
function test(value): Boolean | ||
-- note that value currently has type Any? | ||
if value is String then | ||
-- value is 100% a string | ||
end | ||
|
||
-- what do we want optionals to do? do we want to have to unwrap them? | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
local var = 12 | ||
|
||
if var then | ||
print("hello") | ||
end |
Oops, something went wrong.