Lua API global Variable Viewer (gvv)

by x2605

This is a debugging tool. This mod adds commands /gvv and others and a hotkey(Ctrl+Shift+V) to allow you to check _G and global table of map or each mods. Only admins can use command if it is multiplay game. You have to input some code for temporary accessibility or have to edit "control.lua" of other mod or map to access global table of the mod or map. See "Helper" tab for instructions.

Utilities
2 years ago
1.0 - 1.1
2.71K

b Error message

3 years ago
(updated 3 years ago)

Hi! Just got a message while using your mod:

__gvv__/modules/tree.lua:260: bad argument #1 of 2 to 'pairs' (table expected, got nil)

I've marked some values in the "global" tab of my mod for "Variable trace". There was "global.markers[x][y]" where global.markers[x] had just been set to nil by script. The error message pops up reliably whenever I try to open that value in the "global" tab.

(No damage done, just thought you may want to know about this.)

PS: Sorry for opening a new thread -- I realized too late that you already reserved one for bug reports, but I can't delete this thread.

3 years ago
(updated 3 years ago)

And another error message displayed in the "Variable trace" tab for a removed table:

__gvv__/modules/tree.lua:487: attempt to index local 'value' (a nil value)
3 years ago
(updated 3 years ago)

I guess that's caused because of tree GUI doesn't refresh automatically. Tree GUI does not automatically refresh itself.
You can manually refresh tree GUI in "global"(or property or LuaObject) tab by clicking "mod/object entry currently shown" at tree GUI at "left side bar".

Error message in "Variable trace" is normal because the parent table reference became nil. Getting index(child) of nil(was table before) is impossible, because it is gone.

3 years ago
(updated 3 years ago)

If you want to monitor a blinking(repeating created/deleted) table and its contents, try to register table itself and custom code for sniffing childrens at "Variable Trace".
For example, if blinking table is following,

global.a = { {1}, {2}, {3}, {4} }

register global.a to monitor number of childrens,
and register some custom code for monitor children contents

-- example
assert(function()
  local tbl = remote.call("__your-mod-name__gvv","global").a
  local str = ""
  for k,v in pairs(tbl) do
    str = str .. tostring(v) .. ", "
  end
  return str
end)()

will collect your demand contents of childrens of the table as a output string.

New thread is fine. :)

New response