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
➜ Lua Modules
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Daved
(12 posts) Bio
|
Date
| Wed 07 Apr 2010 12:47 AM (UTC) |
Message
| So I'm rewriting my system for aetolia, looking at Lusternia's treant system as a guide. I've put up my main script file and a snippet from my affliction tracking script file on lua.pastebin here:
http://lua.pastebin.com/A36csk44
http://lua.pastebin.com/buTiziBm
I'm getting this error from MUSHClient:
Run-time error
World: AMTS
Immediate execution
.\affs.lua:21: attempt to index global 'affs' (a nil value)
stack traceback:
.\affs.lua:21: in main chunk
[C]: in function 'require'
[string "Script file"]:7: in main chunk
Any advice is appreciated. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 07 Apr 2010 01:09 AM (UTC) |
Message
| I don't see where you are creating the affs table. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Daved
(12 posts) Bio
|
Date
| Reply #2 on Wed 07 Apr 2010 01:13 AM (UTC) |
Message
| There's no aff table, or shouldn't be. Line 21 that the error message references is:
21: function affs:init()
22: afflictions = {}
23: affs:diag()
24: end
It seems to be having a problem with the name of the function, but I'm not terribly sure that's the case since I used the same format that the Treat system in Lusternia uses. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #3 on Wed 07 Apr 2010 01:16 AM (UTC) Amended on Wed 07 Apr 2010 01:17 AM (UTC) by Twisol
|
Message
|
Daved said:
There's no aff table, or shouldn't be. Line 21 that the error message references is:
21: function affs:init()
22: afflictions = {}
23: affs:diag()
24: end
It seems to be having a problem with the name of the function, but I'm not terribly sure that's the case since I used the same format that the Treat system in Lusternia uses.
Right, that's the problem. The syntax "function affs:init()" is interpreted by the Lua parser exactly as though it were "affs.init = function(self)". You need to have an "affs" table to put the "init" function into, or this syntax won't work. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | 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.
11,839 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top