Open yessiest opened 1 year ago
from the source it seems like awful.titlebar doesn't use :
for get_children_by_id
but instead .
.
For reference: lib/awful/titlebar.lua:807
Hello @yessiest, do you have a code example of what you are actually doing?
@paulhersch, note that the line you are pointing to is a basic function assignation to a member of the returned table. It does not define how the user should invoke the function. The colon operator in Lua is a kind of Syntactic Sugar. foo:bar(1)
is strictly equivalent to foo.bar(foo, 1)
. See https://www.lua.org/pil/16.html
I don't see why a code example would be needed in this case.
The local get_children_by_id
attempts to index a value self._drawable
, which doesn't exist. self
is the drawable (ret = drawable()
in the constructor).
So the first step to try would be
- if self._drawable._widget
- and self._drawable._widget._private
- and self._drawable._widget._private.by_id then
- return self._drawable.widget._private.by_id[name]
+ local widget = self:get_widget()
+
+ if widget
+ and widget._private
+ and widget._private.by_id then
+ return widget._private.by_id[name]
end
Though, a better approach than relying on accessing _private
would probably be to remove the custom get_children_by_id
and to rely on the fact that base.widget.setup
sets up its own version of that method.
Any solutions for this one? I can't seem to get it working, trying to access a textbox widget in a titlebar to set the markup but errors at get_children_by_id. Change suggested by @sclu1034 broke awesome.
Output of
awesome --version
:How to reproduce the issue:
Create an
awful.titlebar
object and call:get_children_by_id("<some valid widget id>")
on itActual result: A nil value error
Expected result:
A table of widgets with matching ids (the default behavior of :get_children_by_id)