5

Is there a list or method to determine a list of the lua functions available/installed?

Sofar I could only find the lua source files. Maybe I should write something that search through all the installed lua files for lines starting with "function". Then I will have a list, but it would still not give me the rest of detail of the functions.

Any better ideas or suggestions?

8

You know the LuaTeX functions short reference? That together with the Lua reference should cover all available functions if I am correct.

  • TNX I hoped that it was part of the installation I have. It will come to good use, I already printed it. – Louis Jul 26 '11 at 11:16
  • Unfortunately that first link is now dead. – Andrew Swann Dec 26 '15 at 13:50
  • @AndrewSwann fixed, although it is probably not a permanent fix. – topskip Dec 29 '15 at 10:08
6

This is hard to answer, as you are asking the lua equivalent of 'what are the names of all defined macros?'. The answer is: it depends.

The core luatex functions are documented in the reference manual, as Patrick wrote in his answer. Everything else is loaded from lua source files on your hard-disk, but only if you (possibly indirectly) asked for it, just as would be the case for macros/packages.

If you are only interested in a list of defined lua functions in your current luatex source file, you can try this inside a lua code block:

function dump (prefix, a) 
  for i,v in pairs (a) do
    if type(v) == "table" then
      dump(prefix .. '.' .. i,v)
    elseif type(v) == "function" then
      print (prefix .. '.' .. i .. '()')
    end 
  end
end
dump('_G',_G)

but there are two caveats:

  • you only get to know function names, not their calling conventions. This is about as useful as only knowing macro names (meaning: not very useful at all)

  • circular references to tables will confuse this bit of lua code, it needs to be made smarter to allow for that

  • TNX also. I was looking for info to extend the other answer I have received regarding a table of fonts. The idea is if I know the function better I can maybe print a better table. – Louis Jul 26 '11 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.