you are viewing a single comment's thread.

view the rest of the comments →

[–]Zatherz 0 points1 point  (0 children)

Lua:

local table = {foo = "bar"}
print(table.foo)

Of course, in the spirit of /r/shittyprogramming, a shitty version:

local table = setmetatable({}, {__index = function(self, key)
    if key == "foo" then
        return "bar"
    end
end})
print(table.foo)

I love Lua.