Sorry, I've accidentally replaced my original bug report with what was meant as a follow-up message. Here is the original text again:
With gvv 0.5.11, gvv errors in remote.call("__autodrive__gvv", "_G")
and remote.call("__autodrive__gvv", "storage")
. The game doesn't crash, but when clicking on the "autodrive" button in the "storage" tab of gvv's GUI, I only get an error message returned by my mod instead of seeing the contents of my tables.
The crash is caused by the following snippet I've added to my control.lua:
local allowed_vars = {
data = true,
game = true,
mods = true,
}
setmetatable(_ENV, {
__newindex = function(self, key, value) -- locked_global_write
error('\n\n[ER Global Lock] Forbidden global *write*:\n' ..
serpent.line({key = key or '<nil>', value = value or '<nil>'})..'\n')
end,
__index = function(self, key) -- locked_global_read
if not allowed_vars[key] then
error('\n\n[ER Global Lock] Forbidden global *read*:\n' ..
serpent.line({key = key or '<nil>'})..'\n')
end
end
})
This is a safeguard against using undeclared variables. I use this in all my mods that act in the control stage. Some modders I've collaborated with have also added the snippet to their mods (e.g., Vehicle Wagon 2 by robot256). According to the error message, function __newindex
is called for copy_object
, which is not declared in the context of autodrive.