Can't specify a type for variants
The current code, at least for ldbus, seems to derive the actual type of a variant at runtime. This however means certain types, in particular numerical types, cannot be expressed. Additionally, considering properties are implemented with a Get that returns a variant, properties aren't actually of the type they claim to be, nor are they ever typechecked.
For now I've monkeypatched it in my own code using the following:
local orig_append = luadbus.raw.append_arg
function luadbus.raw.append_arg(iter, value, typ, subtyp)
if typ == "v" and type(value) == "function" then
value, subtyp = value()
local subiter = iter:open_container("v", subtyp)
luadbus.raw.append_arg(subiter, value, subtyp)
iter:close_container(subiter)
return
end
return orig_append(iter, value, typ, subtyp)
end
This allows a variant to be a function, returning the value then the type. Not the cleanest solution, but it works for now. Of course it still requires things like the Properties interface to be updated, or the read function returning such a functio
This project is dead, but for anyone still using this and some other things on the dbus backend are fixed in: https://github.com/dodo/lua-dbus/pull/5