Perfect! This will give me enough to go on with. On Thu, May 13, 2021 at 3:46 AM Albert Krewinkel wrote: > > Norman Ramsey writes: > > > luacheck works with one module at a time, so all I need to do is figure > out > > the _names_ of the callable objects. I could poke at metatables or could > > assume conservatively that all objects are callable. What I don't know > how > > to do is find callable names that _aren't_ materialized in the `pandoc` > > table but are available only via an `__index` metamethod. > > We don't do any metatable magic on the pandoc module itself, so > iterating over the module table should give us all objects. As BPJ > points out, some functions are actually callable tables, so we have to > check for those. Also, the three objects 'Block', 'Inline', and > 'MetaValue' are callable, but always lead to errors when called. > Therefore, the following code should print all the names we are after: > > local dont_call = pandoc.List{'Block', 'Inline', 'MetaValue'} > > for k, v in pairs(pandoc) do > if not dont_call:includes(k) and > (type(v) == 'function' or > getmetatable(v) and getmetatable(v).__call) then > print(k) > end > end > > The refactored Lua subsystem that I'm working on will do away with these > silly inconsistencies -- just testing if an object has type "function" > will be enough. > > > > On Tuesday, May 11, 2021 at 4:21:47 AM UTC-4 BP wrote: > > > >> Den tis 11 maj 2021 01:16Norman Ramsey skrev: > >> > >>> I've recently discovered `luacheck`, a fantastic static-analysis tool > for > >>> Lua programs. I'd like to use it with my Pandoc filters, but it needs > a > >>> configuration to tell it what functions in the global `pandoc` table > are OK > >>> to call. If anybody happens to have made such a configuration, please > let > >>> us know. > >> > >> > >> I guess the fact that most of the constructors in the pandoc library are > >> actually callable objects rather than functions may be a problem one > way or > >> another. > > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > > -- > You received this message because you are subscribed to a topic in the > Google Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/pandoc-discuss/Uzk5WJOxDmg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/87mtszyt2e.fsf%40zeitkraut.de > . > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CACDk%2BQFFW3WKYo70rwz63QK-oCtuDnOzBjuQVdXWkvgv4HMwrw%40mail.gmail.com.