mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-11 02:30:07 +00:00
CPunch
8ac8085d20
- 'var' has some weird scoping connotations with users of JS. better to change it to 'let', which will decide whether to make the variable a local or a global - 'func' looks visually appealing lol - some minor refactoring done in cparse.c
20 lines
372 B
Plaintext
20 lines
372 B
Plaintext
let object = {
|
|
__setter = [
|
|
"field1" = function(self, val)
|
|
print("setter for field1 called!")
|
|
self.x = val
|
|
end
|
|
],
|
|
|
|
__getter = [
|
|
"field1" = function(self)
|
|
print("getter for field1 called!")
|
|
|
|
return self.x + 1
|
|
end
|
|
]
|
|
}
|
|
|
|
object.field1 = 1337
|
|
|
|
print("got field: " .. object.field1) |