Lua-ubus: Subscriber object in notify function?

I'm just writing some code to access the hostapd via ubus. I would like to know from which hostapd I received some ubus msg:

Normally, I would use container_of (in c), but is there some equiavalent function in lua?

A working solution is to add the inteface into the function:


local function subscribe_interfaces(ctx)
    for _, ifname in ipairs(get_wifi_interfaces(ctx)) do
        print("Subscribing to " .. ifname)
        local sub = {
            notify = function(msg, method)
                local ifname = ifname,
                print(method)
                print(json.stringify(msg))
            end,
        }
        ctx:subscribe("hostapd." .. ifname, sub)
    end
end

This seems weird. ^^