Open fstirlitz opened 7 years ago
Looks like the third argument of component.create
is supposed to be the name. According to git grep
, there are many calls to that function with just two arguments (not just in cairo).
A possible fix (besides fixing all callers) might be:
diff --git a/lgi/component.lua b/lgi/component.lua
index a6803ae..d15a177 100644
--- a/lgi/component.lua
+++ b/lgi/component.lua
@@ -319,7 +319,7 @@ function component.create(info, mt, name)
end
-- Fill in meta of the compound.
- local component = { _name = name }
+ local component = { _name = name or "__unnamed__" }
if gtype then
-- Bind component in repo, make the relation using GType.
component._gtype = gtype
@fstirlitz What's your Lua version? My Lua 5.2 does not really complain here:
> return tostring(require('lgi').cairo.PathData._field.header[3])
nil
@pavouk I'll leave it up to you to fix this. I don't know if all callers should be fixed or the implementation should work around this issue (as in the above example patch). Also, no idea what good names for these things would be.
I use Lua 5.3.
I'd rather use something that isn't a valid identifier instead of "__unnamed__"
to avoid the usual problems with in-band signalling.
And similarly for
cairo.PathData._field.point
. I got this error by attempting to perform a recursive dump on_G
; I'm not sure where else it may come up.