Displaying tabled data from event handlers
I have a simple question, I'm wanting to display data using gmcp event handlers. There is a lot more to how the mudlet client handles the gmcp data. To explain, what I want to know is how can I store the gmcp tables in my created table each time it's sent from the server?
Here is an example of a table
Here is an example of a table
{ { { id = "330116", attrib = "t", name = "a spiny dogfish", icon = "seacreature" } } }My thought is to create a for loop as shown below
--an empty and nil table myTable = {} --Im checking for only items in the room with an if statement just before the for loop itemsInRoom = gmcp.Char.Items.List.items for k, v in ipairs (itemsInRoom) do table.insert(myTable,itemsInRoom) end --for --Where I would display the name and id to the Geyser.Label end --ifThis is a crude example of lua code
0
Best Answer
-
I tried to pastebin some code, but it's.. long.
Basically, the table has a 'location' key, to tell you where the thing is. 'Room' is things in the room with you, clearly.
Those things also have keys, the 'attrib' flag you listed above. Anything 'm' is a mob, unless it also has 'd' and then it's a corpse. The "gmcp.Char.Items.List" event is sent whenever you move or look, so you can use it to clear your table and start over. For the rest of the events, you're just getting changes to your existing table.You grabbed my hand and we fell into it
Like a daydream.. or a fever5
Answers