lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>data = {
>   1,
>   2,
>   3
>}
>while true do end
>
>Which you will have issues restricting in vanilla lua. Uses of extra functionality such as signals or threading to monitor the time it takes to execute can resolve this issue, though.

Sorry for the spam; I made a sudden jump in logic here which I figured I should clarify. 

It's obviously possible to monitor timing by using a debug hook (see debug.sethook) here, but we run into an issue when we consider the case of C functions that could run forever. In particular, a common problematic line of code is the following:

local s = ".";
for x = 1,50 do
   s = s .. s;
end

The copying of this takes an extremely long time, and unfortunately as time progresses, the copy takes longer and longer. The concat is one (very long nearing the end of this loop) VM instruction that debug hooks won't be able to monitor (well, eventually they would, but by then it's arguable that the time it takes is unaccepable). You also will realize a memory issue as well. You will need extra utilities to robustly handle this.

-- Matthew P. Del Buono