Thread Tools Display Modes
01/09/16, 02:31 PM   #1
vandel212
Join Date: Jan 2016
Posts: 17
Export Data

Hi, I'm writing an addon that will export mail attachment data. I am at the point where I collect the information, but I have no idea how to export it to a text file or something that I can use outside of the game.

I was looking into using saved variables, but I don't like that I'm required to reload the UI if I want to see the data that was exported. Any help is greatly appreciated.
  Reply With Quote
01/09/16, 02:34 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
There is not really an alternative to using savedata. You could show it in a text box and copy it by hand, but that is limited to 1000 characters at a time.
  Reply With Quote
01/09/16, 02:52 PM   #3
vandel212
Join Date: Jan 2016
Posts: 17
I see

Oh I see. So with the saved variables thing, is there a way to make the addon dynamically create variable names based on a counter?

So you might have a counter "x = 1", then the variable name would be something like Item_x
  Reply With Quote
01/09/16, 03:06 PM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Sure. The save data is basically just a lua table. You can assign fields to the table like this:
Lua Code:
  1. for x = 1, 6 do
  2.   saveData["item_" .. x] = item
  3. end
  Reply With Quote
01/09/16, 04:01 PM   #5
vandel212
Join Date: Jan 2016
Posts: 17
Originally Posted by sirinsidiator View Post
Sure. The save data is basically just a lua table. You can assign fields to the table like this:
Lua Code:
  1. for x = 1, 6 do
  2.   saveData["item_" .. x] = item
  3. end
Ah sweet! That worked perfect. Last question: There a way to remove a saved variable via the addon?
  Reply With Quote
01/09/16, 06:30 PM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Don't think so. At least I don't know of one. The saved variable files are determined by the addon meta files, which you cannot touch from within the game. You could make a script or program that manages them from outside the game, but I don't think many users would like that.

You can overwrite it with an empty table though if you just want to erase the content.
edit: this is pretty much an answer to your other thread too, so I am not gonna post it twice.

Last edited by sirinsidiator : 01/09/16 at 06:33 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Export Data


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off