I am trying to find a way to queue function to be executed at the prompt. So far, it looks like this:
I use it like this:
I execute the function stored like this:
I need to find a way to check if I have already queued a function. The only way that I can think of is supplying an extra argument to the queue method, an unique id for the function queued so I can compare it with other queued functions.
Any other ideas? This seems rather difficult, as I need to remember all the function ids that I have supplied each time I use the queue for the same function.
function prompt:queue (f)
self ["queued"] [#self ["queued"]+1] = f
end --function
I use it like this:
prompt:queue (function () affs:add ("affliction")end)
I execute the function stored like this:
for k, func in ipairs (prompt ["queued"])do
func ()
end --for
I need to find a way to check if I have already queued a function. The only way that I can think of is supplying an extra argument to the queue method, an unique id for the function queued so I can compare it with other queued functions.
Any other ideas? This seems rather difficult, as I need to remember all the function ids that I have supplied each time I use the queue for the same function.