lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2017-04-24 0:10 GMT+02:00 Jay Carlson <>:

> LuaExpat presented lxp.lom as the API, and LOM trees were
> effectively standardized. So I switched to that. Have I mentioned
> semi-blessing?

Only semi, in this case. LHF has also provided us with an XML module,
which does not use the LOM.

BTW, on my system, if I say `lua -l xml`, I get a module which illustrates
niclely why standards would be useful.

1. I tried 'xml._version' since many modules put useful information in there.
The result was
/usr/local/share/lua/5.3/lub/Autoload.lua:28: module 'xml._version' not found:
    no field package.preload['xml._version']
    no file '/usr/local/share/lua/5.3/xml/_version.lua'
    no file '/usr/local/share/lua/5.3/xml/_version/init.lua'
    no file '/usr/local/lib/lua/5.3/xml/_version.lua'
    no file '/usr/local/lib/lua/5.3/xml/_version/init.lua'
    no file './xml/_version.lua'
    no file './xml/_version/init.lua'
    no file '/usr/local/lib/lua/5.3/xml/'
    no file '/usr/local/lib/lua/5.3/'
    no file './xml/'
    no file '/usr/local/lib/lua/5.3/'
    no file '/usr/local/lib/lua/5.3/'
    no file './'
There is clearly some cleverness with a function as __index metamethod
for the module table itself.
2. used 'pairs' to I list what is in the module and learnt that it has
DESCRIPTION. These look like documentation.
3, The result of xml.VERSION is "1.1.2".
4. The result of xml.DESCRIPTION is a table, not a string.

So I still don't know what this module calls itself. I probably installed it
via LuaRocks. Wait --- the first line of the error message suggests that
the module is called 'lub'. Let's ask LuaRocks for help.

$ luarocks doc lub

Documentation files for lub 1.1.0-1


Opening /usr/local/lib/luarocks/rocks/lub/1.1.0-1/doc/index.html ...

Aha! A page is opening on my browser ... here it comes ...

~~~Online documentation
lua scripts/makedoc.lua && open html/index.html

Click on the link ... tells me that is coming


> xml.DESCRIPTION.summary
Very fast xml parser based on RapidXML
> xml.DESCRIPTION.detailed
    This module is part of the Lubyk project.

    Main features are:
     - Fast and easy to use
     - Complete documentation
     - Based on proven code (RapidXML)
     - Full test coverage

    Read the documentation at

Catch-22 ...

Can you see why I press for standards?