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.

3 days ago
1.0 - 1.1
1399
Owner:
x2605
Source:
x2605/gvv
Homepage:
https://github.com/x2605/gvv
License:
MIT
Created:
10 months ago
Latest Version:
0.4.5 (3 days ago)
Factorio version:
1.0 - 1.1
Downloaded:
1399 times

Type /gvv or press CTRL+SHIFT+V (you can change key bindings) to open GUI. Only admins can use the mod if it is multiplay game.
To allow gvv to access global table of mod, savefile or scenario(start from beginning), you need to modify "control.lua" file of demand mod or map.
Input following code at first line or last line of "control.lua" file of the mod or map.

if script.active_mods["gvv"] then require("__gvv__.gvv")() end

In case of savefile, extract "control.lua" from it first. Then, edit code and overwrite it at same location of "control.lua" inside of the zipped file.
There is also a way to make the mod or map accessible temporarily without editing "control.lua", introduced in in-game GUI.
Most of other helpful words are inside of Helper tab in gvv in-game GUI.

Commands added by this mod

  • /gvv : Opens/closes gvv main GUI window. Only admins or player in singleplay can use this command.
  • /gmods : Prints loaded mod list and global accessible mod list.
  • /gdump : Same as /gdump-luaon
  • /gdump-luaon <mod_name>(optional) : Prints global data of accessible mod in lua object notation format.
    If no <mod_name> is given, level(current map) will be used.
  • /gdump-json <mod_name>(optional) : Prints global data of accessible mod in js object notation format.
    If no <mod_name> is given, level(current map) will be used.

LuaRemote interfaces added by this mod

  • remote.call("__<mod_name>__gvv","global")
    : Returns global table of the mod.
  • remote.call("__<mod_name>__gvv","_G")
    : Returns _G table of the mod. Some data types can not be brought.
  • remote.call("__<mod_name>__gvv","diag")
    : Need to be used only internally. Performs diagnosis of global table of the mod and returns problematic paths as table.
  • remote.call("__<mod_name>__gvv","fix")
    : Need to be used only internally. Performs diagnosis and kills entries that LuaRemote cannot handle in global table of the mod.
  • remote.call("__<mod_name>__gvv","c",<lua_code>, ...)
    : Runs a lua code(string type) in sandbox of the mod, "..." becomes local table named "arg" in the lua code.

Server console exclusive

  • /sc __gvv__ settings.global["gvv-mod_enable-on-tick"]={value= false }
    : Turns off(true for on) that, "on_tick" event used for tracking variables. Admin player already can do this in game GUI.