ioncore.defer takes a _function_. In your code WRegion.rqclose(wmp) will be executed and the result will be passed to defer.

You need to wrap the function call in a lamba like this:
  ioncore.defer(function () WRegion.rqclose(wmp) end)

Ole Jørgen Brønner

On Wed, 03 Jun 2009 22:20:00 +0200, Seb Haezebrouck <> wrote:

You should listen to frame_managed_changed_hook. No need to make
new bindings, just check when a frame becomes empty in that hook.
min_tabs.lua from the scripts repository might provide some useful

Thanks - I did just this, but face yet another issue, this time with the
below code:

local function close_empty_frame(ftable)
    if ftable.mode ~= 'remove' then return end
    local wmp = ftable.reg
-- Should probably test that wmp is not nil here - or is it guaranteed
to contain sth meaningful ?
    if WMPlex.mx_count(wmp) == 0 then

local hk=ioncore.get_hook("frame_managed_changed_hook")

Now the code does not hang anymore, but I get "ion3: Attempt to call an
unsafe function "rqclose" in restricted mode." each time I close the last
client in a frame.

I thought ioncore.defer would do the trick and defer the execution of the
rqclose until I am back in the main loop (so probably out of "restricted"
mode), but it looks like it does not... What am I still missing ?


Reply via email to