mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 16:20:06 +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
16 lines
268 B
Plaintext
16 lines
268 B
Plaintext
// crafts a dummy proto
|
|
proto test
|
|
func __init(self) end
|
|
end
|
|
|
|
// instance of test
|
|
let obj = test()
|
|
|
|
test.__index = function(self, key)
|
|
print("__index called!")
|
|
if (key == "lol") then
|
|
return 9001
|
|
end
|
|
end
|
|
|
|
print(obj["lol"]) // should print 9001? |