Thread Tools Display Modes
11/18/14, 09:32 AM   #1
tangerine0469
Join Date: Nov 2014
Posts: 6
Exclamation Variable Dump

Hi,
first time add on developer here so please be nice and do not berate me for my question even if it sounds stupid/silly/useless/whatever...

I am trying to see all the variables available to an addon that may or may not be listed in the wiki. I know how to make a GUI (as ugly as my first attempts are they still work), make a settings menu and layout the add on files to work when activated. I just need help with the lua code on this as this is my first attempt at lua. I am a regular php/html/javascript user so I get the basics of programming. I did try to something I found on stackoverflow but that only gave me an error:

Link
Code:
function locals()
  local variables = {}
  local idx = 1
  while true do
    local ln, lv = debug.getlocal(2, idx)
    if ln ~= nil then
      variables[ln] = lv
    else
      break
    end
    idx = 1 + idx
  end
  return variables
end
I even tried to Butcher the counter tutorial code to display the variables btu that also ended in the same result. Lastly I have tried to call that (and several variations) function inside of the GUI by using:

Code:
<OnUpdate>
<OnInitialized>
<OnMouseDown>
Which met with either a few or repeating (in the case of the on update, my computer runs at 100 fps) errors






Edit:
I found something that may help me out and do what I want a little easier... the link for the addon is: http://www.esoui.com/downloads/info2...ctiontool.html I will post if it does or if I am still stuck later when I get home.

Last edited by tangerine0469 : 11/18/14 at 09:41 AM. Reason: found a usefull resource
  Reply With Quote
11/18/14, 10:55 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Certainly use Zgoo, it helps a lot.

A note to your piece of code: debug.getlocal won't work. In ESO you only have access to math, string, table modules; debug, io, os, and I think coroutine as well, are disabled.

If you want to iterate over the global table, use zo_insecurePairs:
Lua Code:
  1. for k, v in zo_insecurePairs(_G) do
  2.    ...
  3. end
This is because some functions in there cannot be accessed from add-ons, and regular pairs(_G) bails out when it comes across one.
  Reply With Quote
11/18/14, 11:13 AM   #3
tangerine0469
Join Date: Nov 2014
Posts: 6
Originally Posted by merlight View Post
Certainly use Zgoo, it helps a lot.

A note to your piece of code: debug.getlocal won't work. In ESO you only have access to math, string, table modules; debug, io, os, and I think coroutine as well, are disabled.

If you want to iterate over the global table, use zo_insecurePairs:
Lua Code:
  1. for k, v in zo_insecurePairs(_G) do
  2.    ...
  3. end
This is because some functions in there cannot be accessed from add-ons, and regular pairs(_G) bails out when it comes across one.
Thank you! I will give it a try when I get home. This is definitely an interesting language to learn and knowing the limitations of the API are definitely the first half of the battle.
  Reply With Quote
11/18/14, 11:47 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by merlight View Post
If you want to iterate over the global table, use zo_insecurePairs:
Lua Code:
  1. for k, v in zo_insecurePairs(_G) do
  2.    ...
  3. end
This is because some functions in there cannot be accessed from add-ons, and regular pairs(_G) bails out when it comes across one.
Here is a script snippet posted by Harven, which does that:
http://www.esoui.com/forums/showpost...81&postcount=4
  Reply With Quote
11/18/14, 06:42 PM   #5
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
If you want, below is the link for tool which I have used to make full dump of global variables for this post: PTS 1.5.1 API changes (100009 to 100010 diff)

GlobalDumper.zip
  Reply With Quote
11/20/14, 09:31 AM   #6
tangerine0469
Join Date: Nov 2014
Posts: 6
Originally Posted by Garkin View Post
If you want, below is the link for tool which I have used to make full dump of global variables for this post: PTS 1.5.1 API changes (100009 to 100010 diff)

GlobalDumper.zip
Thank you so much for that dumper and the link to the recent dump it is super helpful! also a bit on the overload side as that is a ton of info to take in... Time to do my homework

Also how do I dump this to a text file? I tried zgoo but its copy command fails with an warnign about ilegal use of copy function.


Edit:
I missed the saved variables part... ignore my question on how to save them...

Last edited by tangerine0469 : 11/21/14 at 07:36 AM. Reason: added question
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Variable Dump


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