-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MiniScript: some initial WIP on script like classes
- Loading branch information
Showing
3 changed files
with
294 additions
and
50 deletions.
There are no files selected for viewing
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,53 @@ | ||
# initialize | ||
on: initialize | ||
console.log("------------------------") | ||
console.log("class-test: Initialize") | ||
console.log("------------------------") | ||
console.log() | ||
end | ||
|
||
function: printABC(=$this) | ||
console.log( | ||
"printABC(): " + | ||
"a: " + $this.a + ", " + | ||
"b: " + $this.b + ", " + | ||
"c: " + $this.c + ", " + | ||
"a*b*c: " + ($this.a * $this.b * $this.c) | ||
) | ||
$this.c = $this.c + 1 | ||
end | ||
|
||
# if no condition is met, nothing will be executed, lol :D | ||
on: nothing | ||
console.log("---------------------") | ||
console.log("class-test: Nothing") | ||
console.log("---------------------") | ||
console.log() | ||
# | ||
$class = { | ||
# member variables | ||
a: 1, | ||
b: 2, | ||
c: 3, | ||
# member methods | ||
printABC: () -> printABC | ||
}; | ||
console.dump($class) | ||
# | ||
$i = 0 | ||
forCondition($i < 5) | ||
$class->printABC() | ||
++$i | ||
end | ||
# | ||
script.stop() | ||
end | ||
|
||
# an error has occurred | ||
on: error | ||
console.log("------------------") | ||
console.log("class-test: Error") | ||
console.log("------------------") | ||
console.log("An error occurred") | ||
script.wait(1000) | ||
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
Oops, something went wrong.