How to capture and store data (and view it via an alias)?

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

This has been working great but now when I 'print' the data I just get the header with no information. I did open the auction_data.lua file with notepad just to see the format. I did not change/save anything with it. Could this have caused the issue?

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

So there are two things you can check. First, you can try just displaying the table the data is stored in with this command: lua display(auction_data)

Second, you can open the error pane in the script window to see if any errors are created when you use the command that prints the data out.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

lua display(auction_data) returns 'nil'

The auction_data.lua file does contain information.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

Even if the file were corrupted in some manner, auction_data should at minimum be displayed as {} (an empty table), not nil. I recommend closing your profile and opening it back up again, to see if that changes things. If it doesn't, then there should be something in the error pane to explain what is going on. If you aren't sure how to find that, just click the button with the red circle with the white exclamation point in the middle of it.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

<[string "Script: initCustom"]:71: bad argument #1 to 'ipairs' (table expected, got nil)>

initCustom is where I add my scripts to the package downloaded from Nyyr. I have both functions you posted here.

Line 71 is...

for k, v in ipairs(auction_data) do
Last edited by Vooku on Wed Jul 25, 2018 1:47 pm, edited 1 time in total.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

Well, something must have changed... though I'm really not sure what could be going on with that. Move the file somewhere else, and it should make a new one, which should then work as expected. Copy the "corrupted" file here and maybe I can see what happened.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

return {{[1] = {2},[2] = {3},[3] = {4},[4] = {5},[5] = {6},[6] = {7},[7] = {8},[8] = {9},[9] = {10},[10] = {11},[11] = {12},[12] = {13},[13] = {14},[14] = {15},[15] = {16},[16] = {17},[17] = {18},[18] = {19},[19] = {20},[20] = {21},[21] = {22},[22] = {23},[23] = {24},[24] = {25},[25] = {26},[26] = {27},[27] = {28},[28] = {29},[29] = {30},[30] = {31},[31] = {32},[32] = {33},[33] = {34},[34] = {35},[35] = {36},[36] = {37},[37] = {38},[38] = {39},[39] = {40},[40] = {41},[41] = {42},},
{[ [[price]] ] = [[600]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a belt of githyanki knighthood]],[ [[buyer]] ] = [[Minz]],},
{[ [[price]] ] = [[14001]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a belt of the mind's eye]],[ [[buyer]] ] = [[Zudak]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[50000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a buckler of infernal flames]],[ [[buyer]] ] = [[Imixilian]],},
{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a charred cloak covered with runic skulls]],[ [[buyer]] ] = [[Zudak]],},
{[ [[price]] ] = [[5600]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a cloak of glittering icicles]],[ [[buyer]] ] = [[Geyreree]],},
{[ [[price]] ] = [[201]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a coautl scale mask]],[ [[buyer]] ] = [[Waroggavad]],},
{[ [[price]] ] = [[2001]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a crystal raindrop]],[ [[buyer]] ] = [[Gabo]],},
{[ [[price]] ] = [[2050]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a crystal raindrop]],[ [[buyer]] ] = [[Gabo]],},
{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a dark blue polkadot cloak]],[ [[buyer]] ] = [[Mobod]],},
{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a deep-blue set of sleeves]],[ [[buyer]] ] = [[Lagac]],},
{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a ghostly bladed gauntlet wreathed in holy light]],[ [[buyer]] ] = [[Mobod]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a githyanki shield etched with silver runes]],[ [[buyer]] ] = [[Ishilia]],},
{[ [[price]] ] = [[10500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a golden circlet lined with fingerbones]],[ [[buyer]] ] = [[Casorus]],},
{[ [[price]] ] = [[1500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a halfling's loot bag]],[ [[buyer]] ] = [[Zudak]],},
{[ [[price]] ] = [[10000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a long flowing robe shifting with shadows]],[ [[buyer]] ] = [[Casorus]],},
{[ [[price]] ] = [[10000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a lump of adamantine ore]],[ [[buyer]] ] = [[Geyreree]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a pair of illithid-hide leggings]],[ [[buyer]] ] = [[Ishilia]],},
{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},
{[ [[price]] ] = [[5000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a shimmering ring of force]],[ [[buyer]] ] = [[Karokizak]],},
{[ [[price]] ] = [[10]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a shiny crimson ring]],[ [[buyer]] ] = [[Mobod]],},
{[ [[price]] ] = [[3000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a silk robe with fingerbone clasps]],[ [[buyer]] ] = [[Zudak]],},
{[ [[price]] ] = [[1050]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: a silver earring shaped like a dagger]],[ [[buyer]] ] = [[Zudak]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a silver shield etched with elvish runes]],[ [[buyer]] ] = [[Ishilia]],},
{[ [[price]] ] = [[1500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a small lich's tear brooch]],[ [[buyer]] ] = [[Casorus]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a steel claymore with emerald runes]],[ [[buyer]] ] = [[Vakig]],},
{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: a steel claymore with emerald runes]],[ [[buyer]] ] = [[Minz]],},
{[ [[price]] ] = [[1600]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a tattoo of swallowing snakes]],[ [[buyer]] ] = [[Minz]],},
{[ [[price]] ] = [[7750]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[Auction: a winged shining steel great helm]],[ [[buyer]] ] = [[Casorus]],},
{[ [[price]] ] = [[750]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: gauntlets of troll strength]],[ [[buyer]] ] = [[Poppibble]],},
{[ [[price]] ] = [[25]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[Auction: some wooden cleric gauntlets]],[ [[buyer]] ] = [[Mobod]],},
{[ [[price]] ] = [[15000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: the bracers of elemental mastery]],[ [[buyer]] ] = [[Vomicopol]],},
{[ [[price]] ] = [[5000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[Auction: the fiery burning crown of Dresk'akla]],[ [[buyer]] ] = [[Kolon]],},
}

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

So other than needing to remove the line breaks, it seems to work fine. Quite possibly notepad forced some line breaks into it, which might be why it is messed up. I do notice that your item name has the extra "Auction: " at the beginning of it, which we can stop from happening if you prefer. Just need to modify your trigger so it starts like this: ^Auction: (.+)
And fortunately all of this data can be recovered. You should be able to use this VERY long command to append all this data to whatever is in your new copy of auction_data:
Code: [show] | [select all] lua
lua local tbl = {{[ [[price]] ] = [[600]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a belt of githyanki knighthood]],[ [[buyer]] ] = [[Minz]],},{[ [[price]] ] = [[14001]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a belt of the mind's eye]],[ [[buyer]] ] = [[Zudak]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a brilliant rune-encrusted arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[50000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a buckler of infernal flames]],[ [[buyer]] ] = [[Imixilian]],},{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a charred cloak covered with runic skulls]],[ [[buyer]] ] = [[Zudak]],},{[ [[price]] ] = [[5600]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a cloak of glittering icicles]],[ [[buyer]] ] = [[Geyreree]],},{[ [[price]] ] = [[201]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a coautl scale mask]],[ [[buyer]] ] = [[Waroggavad]],},{[ [[price]] ] = [[2001]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a crystal raindrop]],[ [[buyer]] ] = [[Gabo]],},{[ [[price]] ] = [[2050]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a crystal raindrop]],[ [[buyer]] ] = [[Gabo]],},{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a dark blue polkadot cloak]],[ [[buyer]] ] = [[Mobod]],},{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a deep-blue set of sleeves]],[ [[buyer]] ] = [[Lagac]],},{[ [[price]] ] = [[100]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a ghostly bladed gauntlet wreathed in holy light]],[ [[buyer]] ] = [[Mobod]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a githyanki shield etched with silver runes]],[ [[buyer]] ] = [[Ishilia]],},{[ [[price]] ] = [[10500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a golden circlet lined with fingerbones]],[ [[buyer]] ] = [[Casorus]],},{[ [[price]] ] = [[1500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a halfling's loot bag]],[ [[buyer]] ] = [[Zudak]],},{[ [[price]] ] = [[10000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a long flowing robe shifting with shadows]],[ [[buyer]] ] = [[Casorus]],},{[ [[price]] ] = [[10000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a lump of adamantine ore]],[ [[buyer]] ] = [[Geyreree]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a pair of illithid-hide leggings]],[ [[buyer]] ] = [[Ishilia]],},{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[250]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a sandstorm arrow]],[ [[buyer]] ] = [[Araka]],},{[ [[price]] ] = [[5000]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a shimmering ring of force]],[ [[buyer]] ] = [[Karokizak]],},{[ [[price]] ] = [[10]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a shiny crimson ring]],[ [[buyer]] ] = [[Mobod]],},{[ [[price]] ] = [[3000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a silk robe with fingerbone clasps]],[ [[buyer]] ] = [[Zudak]],},{[ [[price]] ] = [[1050]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[a silver earring shaped like a dagger]],[ [[buyer]] ] = [[Zudak]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a silver shield etched with elvish runes]],[ [[buyer]] ] = [[Ishilia]],},{[ [[price]] ] = [[1500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a small lich's tear brooch]],[ [[buyer]] ] = [[Casorus]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a steel claymore with emerald runes]],[ [[buyer]] ] = [[Vakig]],},{[ [[price]] ] = [[500]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[a steel claymore with emerald runes]],[ [[buyer]] ] = [[Minz]],},{[ [[price]] ] = [[1600]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a tattoo of swallowing snakes]],[ [[buyer]] ] = [[Minz]],},{[ [[price]] ] = [[7750]],[ [[date]] ] = [[Jul 24, 2018]],[ [[item]] ] = [[a winged shining steel great helm]],[ [[buyer]] ] = [[Casorus]],},{[ [[price]] ] = [[750]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[gauntlets of troll strength]],[ [[buyer]] ] = [[Poppibble]],},{[ [[price]] ] = [[25]],[ [[date]] ] = [[Jul 23, 2018]],[ [[item]] ] = [[some wooden cleric gauntlets]],[ [[buyer]] ] = [[Mobod]],},{[ [[price]] ] = [[15000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[the bracers of elemental mastery]],[ [[buyer]] ] = [[Vomicopol]],},{[ [[price]] ] = [[5000]],[ [[date]] ] = [[Jul 22, 2018]],[ [[item]] ] = [[the fiery burning crown of Dresk'akla]],[ [[buyer]] ] = [[Kolon]],},} auction_data = table.n_union(auction_data,tbl) table.save(getMudletHomeDir() .. "/auction_data.lua", auction_data)
Note that I cut out all instances of "Auction: " from the item names, assuming that you would prefer it that way.

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: How to capture and store data (and view it via an alias)?

Post by Vooku »

I renamed that file to auction_data-old. I still get the same issue. Hmmm...

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: How to capture and store data (and view it via an alias)?

Post by Jor'Mox »

Restart Mudlet. Sometimes it freaks out, and I have no idea why, but closing it and opening it again seems to help.

Post Reply