[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Mon, 11 Jan 2010 11:26:09 -0200
On Sun, Jan 10, 2010 at 12:09 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Sun, Jan 10, 2010 at 3:56 PM, Cosmin Apreutesei
> <cosmin.apreutesei@gmail.com> wrote:
>> Problem is, I don't see how orbit.htmlize() can still be implemented in 5.2 :(
>
> Good question. Would badly miss that one!
>
Something like this could be made to work with getfenv and in:
----------
local orbit = require "orbit"
in module("foo") do
...
in orbit.htmlify() do
function my_view()
return html{ body{ p "foo" } }
end
end
function my_controller(web)
return my_view()
end
...
end
----------
Without getfenv you have to resort to something like:
----------
in module("foo") do
...
local _M = _M
in orbit.htmlify() do
function _M.my_view()
return html{ body{ p "foo" } }
-- all globals here would be html tags
end
end
function my_controller(web)
return my_view()
end
end
----------
I can see myself getting used to this style after a while, but it sure
is more cumbersome.
--
Fabio Mascarenhas
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Alexander Gladysh
- Re: Lua registry, environment, and threads., Cosmin Apreutesei
- Re: Lua registry, environment, and threads., Matthew Wild
- Re: Lua registry, environment, and threads., Cosmin Apreutesei
- Re: Lua registry, environment, and threads., steve donovan