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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  SetPluginVariable? SetWorldVariable?

SetPluginVariable? SetWorldVariable?

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


Posted by Wanghom8228   (19 posts)  [Biography] 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
[Go to top] top

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

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

Posted by WillFa   USA  (525 posts)  [Biography] 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
[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.


15,085 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]