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
➜ varargs
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Robin Lionheart
(14 posts) Bio
|
Date
| Fri 24 Nov 2006 10:12 AM (UTC) |
Message
| I tried to make a varargs function
function debug_message(...)
if GetVariable("Debug") then
Note(unpack(arg))
end
end
But the unpack() line merely threw an error about arg being nil. Perhaps I'm not following the Lua manual correctly. Am I missing something? | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #1 on Fri 24 Nov 2006 10:57 AM (UTC) |
Message
| |
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Fri 24 Nov 2006 08:31 PM (UTC) |
Message
| Not quite, Ked.
Under Lua 5.0 there was a dummy "arg" variable created by Lua for functions that had the "..." syntax. Now (in Lua 5.1) you just refer to "..." where you need the arguments. So your function should look like this:
function debug_message(...)
if GetVariable("Debug") then
Note(...)
end
end
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #3 on Sat 25 Nov 2006 01:37 AM (UTC) |
Message
| Ah, right. I didn't pay attention to how the list was actually being used. | 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.
16,229 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top