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
➜ Lua
➜ 'Include' files in Lua
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Sat 27 Nov 2004 11:55 PM (UTC) |
| Message
| We have had questions in the past about "including" standard scripts into a script file.
Lua provides a very simple function for doing that: dofile.
If you have some standard commands that you want to share, simply do this:
You might want to prepend a path, for example the MUSHclient executable or worlds path. For example:
path = GetInfo (57) -- World files default path (directory)
In that case your include command may look like this:
dofile (GetInfo (57) .. "myfilename.lua")
There is also a "require" function that works similarly, but searches a path (which you can specify) and doesn't load the same file twice.
|
- 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.
19,399 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top