Cosmo/examples/test.cosmo

16 lines
272 B
Plaintext

// crafts a dummy proto
proto test
function __init(self) end
end
// instance of test
var obj = test()
test.__index = function(self, key)
print("__index called!")
if (key == "lol") then
return 9001
end
end
print(obj["lol"]) // should print 9001?