Released on 10 Oct 2006
1. Added script function SendPkt - this is for scripters to do a "low level" send of data to the MUD for doing things like Telnet negotiation options.
2. Increased the number of bits in the Lua "bit" library.
The bitwise operations are now conducted after converting the internal "double" (floating point) Lua numbers into 64-bit integers, rather than 32-bit integers as in the previous versions. This allows more bits of calculation to be done. Internally doubles are stored as 64 bits: 1 for sign, 11 for the exponent, and 52 for the mantissa. Their range is +/–1.7E308 with at least 15 digits of precision.
Since the mantissa of the double has 52 bits, the bitwise operations should be reliable to around 52 bits - this is 30 bits more than in earlier versions of MUSHclient.
3. Added new Lua "bit" library function: bit.ashr.
This is an arithmetic right-shift. This preserves the sign, if you are shifting right a signed number.
4. Added new Lua "bit" library function: bit.mod.
This does an integer modules (remainder after integer divide).
5. Changed the Lua "bit" library to use signed numbers where appropriate rather than unsigned.
6. The bitwise operations now have slightly different rules about the number of arguments. Previously operations like bit.bor would accept zero arguments, now the all need at least one argument. These changes are reflected in the help file.
7. Added new Lua "bit" library function: bit.tonumber.
This takes a string, and converts it into a number.
Unlike the standard Lua tonumber function this function will handle up to a 52-bit number (the default Lua number conversion will only go to 32-bit numbers).
print (bit.tonumber ("A7C5AC471", 16)) --> 45035996273
The base is optional and defaults to 10. The base can be in the range 2 to 36. Fractional numbers are not supported, nor are numbers with exponents (eg. 10.24e15). For such numbers use the standard Lua "tonumber" function.
Because of limitations in the size of a floating point number, the maximum string value that can be converted is a 52 bit number, ie: hex FFFFFFFFFFFFF (decimal 4503599627370495).
Leading whitespace is skipped. After that, there can be an optional + or - sign.
8. Added new Lua "bit" library function: bit.tostring.
This takes a number, and converts it into a string to the given base, in uppercase. The base is optional and defaults to 10. The base can be in the range 2 to 36. Fractional parts are discarded, as the number is first converted to a 64-bit number internally. Negative numbers are OK, and will be converted with a leading "-" sign.
print (bit.tostring (45035996273, 16)) --> A7C5AC471
This is similar to the standard Lua "tostring" function, except that it does not invoke metamethods (that is, the __tostring metamethod), and also allows you to specify a base, unlike the standard function.
9. Added new option to the Command configuration (under the Tab Completion button) - this lets you limit the number of lines that are searched for tab-completing a word. The default is 200 lines. The intent is to stop a long pause if you have thousands of lines in your output buffer.
10. Added a new (world) script function: Metaphone
This converts a supplied word into a "phonetic" character string. The intention is that this string can be used in a spell-checker for finding words that sound similar.
Also added Lua script function utils.metaphone. This is similar to the world script function, except that it returns two results - the primary metaphone, and the secondary one if it exists, or nil if not.
m1, m2 = utils.metaphone ("thisisstrange") --> 0SST, TSST
11. New Edit menu item - "Convert Clipboard Forum Codes" (Shift+Ctrl+Alt+Q).
This is for making posts on the Forum, if there is text on the clipboard it is converted for making a post, which converts:
[ to \[
] to \]
\ to \\
This saves the trouble of creating a notepad document, pasting the text, converting it, and copying the resulting changes.
Also there is a dialog that confirms the change, in case you do it accidentally and corrupt your clipboard contents.
12. Fixed problem with error messages when using Lua on other worlds than the current world. For example, with earlier versions of MUSHclient:
w = GetWorld ("smaug")
w:ChatCall () --> error: calling 'ChatCall' on bad self (string expected, got no value)
The "bad self" part was misleading, as MUSHclient pulls the "self" argument off the stack. Also, if you had an error in the 2nd argument, it would have reported that argument #1 was wrong (and so on).
Now it looks like this:
w:ChatCall () --> error: bad argument #1 to 'ChatCall' (string expected, got no value)
13. Fixed problem where, when scripting in Lua, if you wanted to supply a userdatum as the first argument to a function call, you would get an error message about it not being a MUSHclient world.
In earlier versions:
r = rex.new ("abc")
print (r) --> bad argument #1 to 'print' (mushclient.world expected, got userdata)
Now it works correctly:
r = rex.new ("abc")
print (r) --> pcre_regex (01B8F708)
14. Added new script library "progress". This provides functionality for displaying a "progress" dialog box during length operations.
First you create the progress dialog with:
That returns a userdata item that you can then use in subsequent operations:
dlg:status (msg) --> set a status message (eg. "processing 'foo' ")
dlg:range (low, high) --> sets the range of operations (eg. 1 to 100)
dlg:position (pos) --> sets where we are in the range (eg. 80)
dlg:checkcancel () --> returns true if the user clicked on the cancel button
dlg:setstep (amount) --> sets the step amount (eg. 5)
dlg:step () --> increase the position by the step amount
dlg:close () --> dismiss the progress dialog
Example of use:
local dlg = progress.new ("Loading things ...")
dlg:range (0, 3) --> 3 steps
dlg:setstep (1) --> step 1 per step
dlg:status ("Processing foo") --> first step
-- do something lengthy here
dlg:status ("Processing bar") --> second step
-- do something lengthy here
dlg:status ("Processing fruit") --> third step
-- do something lengthy here
dlg:close () --> all done
Warning - the progress dialog is a modal dialog box. If it is not closed then you will be unable to access any of the MUSHclient GUI functions. Any function that uses the progress dialog should take steps to ensure that it is closed, even if there is a script error of some sort. Use the "pcall" function to ensure that you can recover from errors.
15. Added a new Lua script function: utils.spellcheckdialog.
This is called with two arguments, the first being the misspelt word, the second being a table of suggested replacement words.
If this dialog is cancelled, utils.spellcheckdialog return nil.
Otherwise, it returns two things (which are strings):
The action can be one of: ignore, ignoreall, add, change, changeall.
The replacement is the replacement word - if the user chose "change" or "changeall" (or double-clicked a suggested word).
16. Added a new Lua script function: utils.info.
This returns a table with the following things in it:
"current_directory" --> the current directory
"app_directory" --> the directory in which MUSHclient.exe resides
"world_files_directory" --> the default world files directory
"log_files_directory" --> the default log files directory
"plugins_directory" --> the default plugins directory
This function is primarily intended for situations where you do not have access to the world "Info" functions, such as in the spell-checker.
17. Added new "custom" spell checker. This is written in Lua and is intended to eventually replace the existing spell checker. See this forum posting for more details about it:
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )