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 ➜ Displaying table in note or send not working for me

Displaying table in note or send not working for me

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


Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Wed 13 Jan 2016 04:41 PM (UTC)

Amended on Tue 19 Jan 2016 03:57 PM (UTC) by TruckDriver22

Message
my bash_table has a few names it and it works on triggers but it wont display cannot seem to figure out why.

i fill it with another alias that uses this to capture

<aliases>
  <alias
   name="pkmode"
   match="pkmode (?P&lt;bashed&gt;([A-z][a-z]+))"
   enabled="y"
   group="autobash"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger("punch",true)
EnableTrigger("repunch",true)
EnableTriggerGroup("autobash",true)
EnableTriggerGroup("Tankmode",false)
EnableTriggerGroup("Assistmode",false)
EnableTriggerGroup("Bashmode",false)
EnableTriggerGroup("disarm",false)
EnableTimer("rescuecasters",false)
EnableTimerGroup("assistbot101",false)
EnableTimer("assist",false)
EnableTimerGroup("Assistmode",false)
Note("pkmode")
bash_table = bash_table or {}
bash_table.%&lt;bashed&gt; = true
Alertbox = assert (GetWorld ("Alertbox"),"Alertbox not open")  
-- gets the world
Alertbox:ColourNote("black", "white", "Basher AUTO BASHING %&lt;bashed&gt;")</send>
  </alias>
</aliases>


then i would assume this would display the table
but it shows it as empty.
alias
pklist..is

<aliases>
  <alias
   match="pklist"
   enabled="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
  >
  <send>bash_table = bash_table or {}
Note(table.concat (bash_table, ","))
t_t = 
  {
  "the", 
  "quick", 
  "brown", 
  "fox", 
  "jumped",
}

Note(table.concat (t_t, ","))</send>
  </alias>
</aliases>


--- thanks in advance for any help with this as it has been a journey getting as far as i have carefully going threw many post in here by nick and others.

Click bang... GAME OVER!
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Wed 13 Jan 2016 08:01 PM (UTC)
Message
Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #2 on Tue 19 Jan 2016 04:31 AM (UTC)
Message
ok next time i have a question ill do that. so no help on this?

Click bang... GAME OVER!
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Tue 19 Jan 2016 04:45 AM (UTC)
Message
For us to help you, we need to be able to read the info the way the client sees it rather than trying to guess at white space and bracket matches and such.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Nick Gammon   Australia  (23,094 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 19 Jan 2016 06:10 AM (UTC)
Message
TruckDriver22 said:

ok next time i have a question ill do that. so no help on this?


Do you have a problem with editing your question and making it easier for people to help you? Next time you'll do that, eh? Why not this time?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by TruckDriver22   Denmark  (22 posts)  Bio
Date Reply #5 on Tue 19 Jan 2016 04:00 PM (UTC)
Message
I have put in the coding and added my entire alias.
that wasn’t so hard at all. when i actually have time to look at things.

Click bang... GAME OVER!
Top

Posted by Nick Gammon   Australia  (23,094 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 19 Jan 2016 08:41 PM (UTC)

Amended on Tue 19 Jan 2016 08:42 PM (UTC) by Nick Gammon

Message
The table.concat function works on numerically-keyed tables.

So, your example of:


t_t = 
  {
  "the", 
  "quick", 
  "brown", 
  "fox", 
  "jumped",
}

Note(table.concat (t_t, ","))


... works like this:


the,quick,brown,fox,jumped


However with alpha keys (as you seem to be using) it won't:


bash_table = {
  fox = true,
  naga = true,
  }
Note(table.concat (bash_table, ","))


Output:





One approach is to copy the items from your table to a temporary table for displaying:


bash_table = {
  fox = true,
  naga = true,
  }

temp = { }
for k, v in pairs (bash_table) do
  table.insert (temp, k)
end -- for

table.sort (temp)
Note(table.concat (temp, ","))


Output:


fox,naga

- 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.


20,343 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.