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

i Some watch items by default to give people some first impression

3 years ago

I tried some watch command(in the first tab), such as
game.surfaces[1].get_tile(game.players[1].position).name
or
game.players[1].name
Very intuitive.
And, I think an item with
game.tile_prototypes
would be very helpful for the people who see this mod the first time.

Btw, for the edit popup text editor, now it has only one button at the bottom with "accept". Why not 2 buttons, one for overwriting, one for push to the bottom.
And I think the delete button should be in the end of each item, rather than at the top. Means one clicking one deleting, rather than selecting and then head for the deleting button. The existing way is already good. It doesn't matter which way you prefer. Only a short suggestion.

3 years ago

Thanks for giving me feedback. For now, I don't have plan to change initial examples. However, your suggested examples looks so nice and useful!
I made this for only modders who want to develop control.lua code. I believe that they have at least some knowledge about it. I want to let them to use this thier own ways. So I think just showing possibility to use lua code is quite enough.

Why the way to delete an list item is designed as "check and click-button" is that, I thought there is no simpler and saving UI space way in Factorio GUI system. Still I don't know how to make right-context menu system like Windows OS or web browsers, which Factorio can't do. And the ways to place scroll-bar is also quite limited. I couldn't find a way to get both saving screen space and convenience. Assigning more hot key is never recommended because it is shared across entire game play and steals other mod's opportunity. Even I don't believe to assign hotkey for GUI element processing is simple. I want to leave it possible to prevent single click to delete for preventing misclicking.

If you want to add similar context to existing entry, just copy first and add new. I'm considering to add reordering.

3 years ago

In fact, I work on ms visual studio a lot. In vs, the watch widget doesn't provide any reordering function. And it works well enough.
Btw, I tried /c mytable = {a=1,b=2}, how can I find this mytable in this epic mod? Thanks.

3 years ago

Updated 0.3.2 version now have reordering for tracking entries.
You may can find your _G variable at
remote.call("__level__gvv","_G").mytable
if level is enabled to read by gvv

3 years ago

I tried remote.call("level__gvv","_G").mytable
and got this
Unknown interface: __level__gvv
stack traceback:
[string "return remote.call("__level__gvv","_G").mytab..."]:1: in main chunk
__gvv
/modules/tracking.lua:74: in function <gvv/modules/tracking.lua:68>
[C]: in function 'pcall'
gvv/modules/tracking.lua:87: in function 'refresh_value'
gvv/modules/tracking.lua:106: in function <gvv/modules/tracking.lua:96>

emmm, without some tutorial, I have to face a lot guess work. Should I wait, or go for some other tutorial?

3 years ago
(updated 3 years ago)

If you didn't put a code in "control.lua" for giving access to gvv in your scenario, try session limited(status not able to be saved through saving) enabling method.

How to do is in "Console commands" menu of mod, in "Helper" tab.

There are so much things to read in "Helper" tab.

3 years ago
(updated 3 years ago)

I uploaded an image for you.
https://mods-data.factorio.com/assets/b74a40fbb564052b34859fdf7fc42faec6ffded8.png

"Unknown interface: __<mod_name>__gvv" is a common error message while using this mod.
It means you forgot to give access to that mod to gvv, forgot putting the enabling code in "control.lua" or pasting session limited command in chatting console.

3 years ago

Oh,, haha ,I read the first one, but didn't move on to the next. I neither expected the authority problem. OK, I'll read them all before I move on. Thank you for answering.

3 years ago

By the way, a small thing. My monitor is 2k, so the max width of the main widget of this mod could have a bigger max width than it has now. The max height is just ok for 2k but no idea how it appears on 4k.

New response