vkka
Joined 5 years ago
Karma
16
Submissions
4
Member since
Jun 17
Joined 5 years ago
local p = { x = 1, y = 2 }
print( p.x, p.y )
setmetatable( p,
{
__newindex = function() assert( false ) end,
__index = function() assert( false ) end
} )
print( p.z ) -- you get assertion failure
p.k = 12 -- you get assertion failure tooMore efficient? Yes. Simpler? Not really. A synchronous program would be simpler, everyone who has done enough of these know it.
[1] https://www.veryansintv.com/veryansin-tv-aylarca-haykirdi-ik... [2] https://www.youtube.com/watch?v=v6jJjDjylPg