Register forum user name Search FAQ

Gammon Forum

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 ➜ SetPluginVariable? SetWorldVariable?

SetPluginVariable? SetWorldVariable?

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


Posted by Wanghom8228   (19 posts)  Bio
Date Sun 05 Sep 2010 11:32 PM (UTC)

Amended on Sun 05 Sep 2010 11:33 PM (UTC) by Wanghom8228

Message
Hi Nick:
I noticed you updated the CallPlugin funcation recently.
Do you have a plan to add a new funcation like "SetPluginVariable" or "SetWorldVariable"??

I need this feature, but didn't find a workaround.

Thanks
Hong
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Sun 05 Sep 2010 11:44 PM (UTC)

Amended on Sun 05 Sep 2010 11:48 PM (UTC) by Twisol

Message
I think Nick's going to hate me for this:

CallPlugin("PLUGIN ID HERE", "SetVariable", "foo", "1")


If you want to make this a little cleaner:

function SetPluginVariable(id, key, val)
  return check(CallPlugin(id, "SetVariable", key, val))
end

SetPluginVariable("PLUGIN ID HERE", "foo", "1")


EDIT: There's no way to emulate a SetWorldVariable(), though. CallPlugin won't use a blank id "" to refer to the world, like some other plugins do.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Sun 05 Sep 2010 11:51 PM (UTC)
Message
What I normally recommend is that you create your own function in one plugin that sets a specific variable, and call it with CallPlugin in another. So you'd do something like this:

-- First plugin
function set_target(target)
  SetVariable("target", target)
end

-- Second plugin
CallPlugin("PLUGIN ID HERE", "set_target", "gnoll")


As I showed, you can cut out the middleman by calling SetVariable in the other plugin directly. That feels like a hack though. It's hilarious and awesome, but it's still a hack. ;)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #3 on Mon 06 Sep 2010 01:36 AM (UTC)
Message
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3925&page=1

Will let you work around the issue
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,550 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.