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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Strict module and built-in functions

Strict module and built-in functions

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


Posted by Tspivey   Canada  (54 posts)  [Biography] 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

[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[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.


13,004 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 HostDash]