[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A Lua todo-list DSL
- From: Mateusz Czaplinski <czapkofan@...>
- Date: Wed, 18 May 2011 09:47:44 +0200
Bwahaha, great morning reading, thanks :)
On Wed, May 18, 2011 at 3:15 AM, Jonathan Castello <twisolar@gmail.com> wrote:
> 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
>
>