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.
Entire forum
➜ MUSHclient
➜ Lua
➜ Strict module and built-in functions
Strict module and built-in functions
|
Posting of new messages is disabled at present.
Refresh page
Posted by
| Tspivey
Canada (54 posts) Bio
|
Date
| Fri 09 Apr 2010 08:57 PM (UTC) |
Message
| How can I get the strict module working with MC's built-in
functions, such as Note? Using this very simple
script file generates an error:
require "strict"
Note("test")
And the error generated is:
Error number: 0
Event: Run-time error
Description: [string "Script file"]:2: variable 'Note' is not declared
stack traceback:
[C]: in function 'error'
C:\Program Files\MUSHclient\lua\strict.lua:31: in function <C:\Program Files\MUSHclient\lua\strict.lua:29>
[string "Script file"]:2: in main chunk
Called by: Immediate execution
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Fri 09 Apr 2010 09:41 PM (UTC) |
Message
| Have you tried "world.Note" instead? I don't know if it would work, and it's not exactly ideal if it does, but maybe it'll help. I don't really use strict.lua, either. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #2 on Fri 09 Apr 2010 11:20 PM (UTC) |
Message
| Twisol is right. world.Note works.
This is because Note is not actually in global script space, it is implemented via a metatable entry in the global script space. This keeps all the world functions from cluttering the global space, which really should be kept quite compact if possible. |
- 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.
14,048 views.
Posting of new messages is disabled at present.
Refresh page
top