[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Lua for config files
- From: Petite Abeille <petite.abeille@...>
- Date: Thu, 19 Dec 2013 22:08:53 +0100
On Dec 19, 2013, at 9:39 PM, Sean Conner <sean@conman.org> wrote:
> Furthermore, you do not need a loop:
Well… at least Roberto’s little memory monitor [1] does catch this:
lua: error in __gc metamethod (TestConfig.lua:11: script uses too much memory)
[1]
—8<—
do
-- track memory use
local mt = {__gc = function (u)
if collectgarbage("count") > 10000 then
error("script uses too much memory")
else
setmetatable({}, getmetatable(u))
end
end}
setmetatable({}, mt)
end
—>8—