* Lua References and Library Modules

A place for completed suggestions/corrections.

Moderator: kb admin

Post Reply
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Lua References and Library Modules

Post by tatewise »

This is related to the KB Lua References and Library Modules page and the revised FH v7.0.9 Help page How to Write Plugins > Introduction to Lua > Additional Lua Libraries that now comprehensively list all library modules as I requested.

I notice that the version numbers have already been removed from the KB URL displayed text for the IUP and Penlight online documentation. Thank you.

The following are discrepancies between the KB page and the FH Help page.

LuaCOM
KB page says 'Version 1.3' and links to https://web.tecgraf.puc-rio.br/~rcerq/l ... m-htmldoc/
FH page says 'Version 1.4.1' and its URL link is broken but http://files.luaforge.net/releases/luac ... .4-doc.pdf does exist.
However, https://web.tecgraf.puc-rio.br/~rcerq/luacom/ says the latest stable version is Version 1.3 (for Lua 4 and Lua 5).
I suspect the FH page is wrong and should mirror the KB page. Can somebody in the know confirm?

CD: 2-D Graphics library
KB page says 'Version 5.1.2' which has never existed.
FH page says 'Version 5.12' which does exist.
So I suspect the KB page is a typo that needs correcting.

LuaSocket: Network support
KB page says Version is 'tba (probably 2.0.2)'
FH page says 'Version 2.0.2'
The documentation link says 'LuaSocket version 2.0.2 is now available for download!'
So I suspect the KB page can say it is 2.0.2

utf8: UTF-8 aware string functions
KB page says 'dated 2021-08-11'
FH page says 'Version 5.3' but not sure how it derives that.
Any thoughts would be welcome.

The FH page has several mistakes and broken links that I am reporting to CP since I raised the ticket to update the page.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Lua References and Library Modules

Post by ColeValleyGirl »

LuaCOM doesn't support interrogating its version, as far as I can tell. Best to ask CP which is correct.

CD and LuaSocket entries updated.

utf8 doesn't seem to support interrogating its version, and I can't find a version number in the source. Again, best to ask CP how they derived 5.3 (I'm guessing they've misinterpreted a reference to 5.3).
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Lua References and Library Modules

Post by tatewise »

I will ask CP about those versions along with reporting other problems on their Help page.

While checking through it came to my notice that the KB Notes column on require commands has some errors:

MD5 should use md5 = require ( "md5" )

LUASOCKET should use socket = require ( "socket" )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Lua References and Library Modules

Post by ColeValleyGirl »

Why have you singled those two instances out Mike? They're consistent with all the other entries in that column except for utf8 (which is a particularly complex case).
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Lua References and Library Modules

Post by tatewise »

The CP Help page, the library documentation, and their use in plugins demand that way of using the require() command.
If the assignment to md5 or socket is missing, and just the require() is used, then the library functions do not work.
i.e.
The following (or any variant of it) does NOT work:

require("md5")
smd5 = md5.sumhexa("ABCD")
An error has occurred - plugin failed to complete
[string "C:\Users\Mike\AppData\Local\Temp\~fh6F84.tmp"]:2: attempt to index a nil value (global 'md5')

or

require("md5")
smd5 = sumhexa("ABCD")
An error has occurred - plugin failed to complete
[string "C:\Users\Mike\AppData\Local\Temp\~fh6F84.tmp"]:2: attempt to call a nil value (global 'sumhexa')

but this works OK:
md5 = require("md5")
smd5 = md5.sumhexa("ABCD")

Whereas, somehow loadrequire("md5") does not need the assignment but global md5 gets assigned!

The other library modules such as iuplua, lfs, luacom, etc, do not need the assignment.
Don't ask me why they are different. Maybe it is the way the author implemented them.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Lua References and Library Modules

Post by tatewise »

Thank you for making those changes to require().

We may have to wait some time for clarification of the library versions that differ between the KB and FH Help pages.
Despite promising the comprehensive FH Help page updates in v7.0.9 their response to my report of mistakes is:
"We will update the plugin help in the next update of FH (i.e. the one after 7.0.9)."
So it seems the missing details and broken links will remain until then.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Lua References and Library Modules

Post by ColeValleyGirl »

Closing this -- please raise another topic when CP come back with any clarification.
Post Reply