[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: A Lua todo-list DSL
- From: Jonathan Castello <twisolar@...>
- Date: Tue, 17 May 2011 18:15:38 -0700
I noticed that numbers in Lua can have a trailing decimal point, even
if there's no fractional part (such as "1."). This gave me an idea for
a horrible little DSL that emulates a to-do list:
----
do
local list = {}
local mt = debug.setmetatable(0, {
__call = function (self, content)
list[self] = content
end,
})
; (1.) "Hello, world!"
; (2.) "Get groceries"
for k, v in ipairs(list) do
print(k .. ": " .. v)
end
end
----
It's pretty horrific, but interesting nonetheless.
~Jonathan