Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Error when I use check function

Error when I use check function

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Larkin   (278 posts)  Bio
Date Fri 22 Aug 2008 03:22 PM (UTC)
Message
I tried the built-in version of check first and then the module version (with a require call). Both gave the same error message about the format argument being incorrect.

On the command line:
/print(check(Save("")))


Error message:
Run-time error
World: Lusternia
Immediate execution
[string "Check function"]:1: bad argument #2 to 'format' (number expected, got boolean)
stack traceback:
        [C]: in function 'format'
        [string "Check function"]:1: in function 'check'
        [string "Command line"]:1: in main chunk
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #1 on Fri 22 Aug 2008 05:06 PM (UTC)
Message
Save() doesn't return anything.

check() is best used for the functions whose prototypes say they return a long. i.e.

check(AddTrigger("Bad Label", "*", "Not gunna happen", 1,0,0,"",""))

will cause an eInvalidObjectLabel error to occur.
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #2 on Fri 22 Aug 2008 08:25 PM (UTC)
Message
Yeah, I figured it out when I actually looked at the check function. I guess I was figuring it would be handling return types more generically, using the type method to see what it should print...
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 23 Aug 2008 02:29 AM (UTC)
Message
It can't handle them more generically because all types of numbers in the COM interface just become numbers in Lua.

Plus, some functions (like ColourNameToRGB) actually return a long, it just isn't a status code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,125 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.