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
➜ Plugins
➜ Hyperlink Syntax question
Hyperlink Syntax question
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Horath
United Kingdom (5 posts) Bio
|
Date
| Mon 16 Jan 2012 10:53 PM (UTC) |
Message
| Hi. I've been playing round with hyperlinks and have happily got several working. I'm now running into a problem. I'm hopeing im missing something blindingly obvious and its easy to fix.
All the hyperlinks I have working are in the format
Hyperlink ("!!" .. GetPluginID () .. ":content_save_hyperlink(" .. variable1 .. ")", name_line, "Click", "", "", false)
with a function
function content_save_hyperlink(var1)
print(var1)
end
somewhere in the plugin
if variable1 in the hyperlink were equal to "here" as an example the hyperlink when clicked prints quite simply "here"
I now have a hyperlink I would like to pass 2 variables to at the same time however using
Hyperlink ("!!" .. GetPluginID () .. ":content_save_hyperlink(" .. variable1 .. ", " .. variable2 .. ")", name_line, "Click", "", "", false)
with a function
function content_save_hyperlink(var1, var2)
print(var1, ":", var2)
end
somewhere in the plugin
If for example variable1 = "this" and variable2 = "here" in the hyperlink I now get from the function printing
"this, here: nil" (so var1 = "this, here" and var2 = nil)
Am I missing something or does the hyperlink sub function only accept single variables.
If this is so I can hack around it by passing both values as a single variable and then spliting them into 2 variables in the linked function (based on space, comma or whatever) but this isnt a particularly elegant solution as in the actual plugin the function the hyperlink is calling is used elsewhere as well where it doesnt require extra code to run through to split up lumped variables
Hope Im missing something | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 17 Jan 2012 03:39 AM (UTC) |
Message
| The argument is passed to your function "as a string" as the documentation says. So in your case:
function content_save_hyperlink(var1)
print(var1)
end
So var1 = "this, here" (as you acknowledge).
All you need to do is use a string.match or similar on that variable to break it into words. |
- 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.
9,574 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top