lua-users home
lua-l archive

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


Hello!

Briefly,
In modern versions of Lua, host application works with Lua functions
(and, more generally, tables and threads) only via stack (am I right?).
Is there a way to store their values somewhere for future use?

More specifically,
I work on a computationally complex problem of constraint satisfaction
(specifically, it's a university timetabling problem). I'm going to use
Lua interface for constraints specifying.

E.g., a call like

        hard({Lecture, Lecture}, function(lec, lec2)
                                   return (lec1.time ~= lec2.time
                                        or lec1.room ~= lec2.room)
                                 end)

creates a hard constraint that forbids placing 2 different events of
type Lecture at the same room at the same time. It specifies a Lua
function that checks the constraint.

Such functions are called at each step of the search algorithm. Is
there a way to call them immediately, without retrieving from somewhere
every time?