Update to Base documentation?

Posted by WillFa on Sun 05 Feb 2006 02:26 AM — 2 posts, 8,390 views.

USA #0
Hey Nick. :)

I've been running MushClient 3.70 under Wine on Fedora. So I need to learn Lua.

Could you clarify the documentation for the Unpack() function in the Base docs?



In python (and also in Lua!!), you can unpack an array/dictionary easily with multiple assignments on a line. (a, b, c = 1,2,3) I noticed unpack in the docs, but it appears from the docs that there isn't a difference between table.concat and unpack.

Could you note that concat returns one variable of all values run together, while unpack returns n variables for n values?

For Example:
Trigger: HP: (%d)/(%d) SP: (%d)/(%d)
Script: iHP, iHPMax, iSP, iSPMax = unpack(arrWildCards)
Note (iHP)
Note (iSP)

prints:
100
100

Script: iHP, iHPMax, iSP, iSPMax = table.concat(arrWildCards)
Note (iHP)
Note (iSP)

prints:
100 200 100 200
nil


The current documentation is unclear since print() and Note() handle multiple parameters transparently.


I've worked around the confusion by updating my trigger itself with NamedParameters (HP: (?P<iHP>%d)/...) before I figured it out.


Oh, you had also mentioned that if there was an interest, you'd distribute MushClient in a tarball as well. :)

Thanks!
Australia Forum Administrator #1
I have clarified the documentation slightly as you requested. I will do a tarball shortly when I release version 3.74.