mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-21 23:10:05 +00:00
CPunch
e993cdd9fa
cosmoO_getObject and cosmoO_setObject were renamed to cosmoV_getRawObject and cosmoV_setRawObject respectively `__init` is now required to be defined for a proto object to be instantiated. other minor refactoring work done in src/cvm.c
16 lines
272 B
Plaintext
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? |