[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Implementation notes
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Implementation notes

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


Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Wed 24 Nov 2004 09:02 AM (UTC)

Amended on Wed 24 Nov 2004 09:03 AM (UTC) by Nick Gammon

Message
All of the documented MUSHclient "world" functions are in the "world" table in the Lua interface. Note that the word "world" is a table, not a COM object. You can list all of the available functions like this:


for k in pairs (world) do print (k) end


This lists all functions exposed in the world table.

Note that in Lua function names are case-sensitive. That means that the "ColourNote" function is spelt "ColourNote" and not "colournote" nor "Colournote".

To make things easier, all world functions are also exposed as global functions, by using a metatable on the global table (the _G table).

Thus, you can do either:

world.Note ("hello")

or

Note ("hello")


Also, the "print" function, which is used extensively in the Lua tutorials, is linked to the "Note" function, so doing "print" in MUSHclient Lua is the same as Note.

To check the exact spelling of each function, look at:


http://www.gammon.com.au/scripts/function.php


or


http://www.gammon.com.au/scripts/doc.php


These list the meaning of all functions, and their exact spelling and capitalization.

Also, both pages list "Lua notes" which describe any differences in function behaviour under Lua.

Almost all functions behave the same under Lua as under other script languages, the notable exceptions being:


  • GetTrigger, GetAlias, GetTimer.

    These three functions returned data "by reference" which is not supported by Lua. Instead, they return their information as multiple function results. Read the documentation for more details.

  • Open.

    This function returns a COM object. This is not supported under Lua, so it returns nil instead.

  • Various functions have an optional last argument, which if omitted has various useful defaults. Read the documentation for more details.

  • Some functions have extended functionality if used in a different way. For example, GetVariableList returns a table of not only the variable names, but also their contents.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


2,245 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]