I have two scenarios and I cannot combine both scenarios into one. There must be two runs.
Script A is almost completely local, but it calls a global function several times. They are defined in Script B. I would like to know if it is possible that the function uses local variables inside Script A somehow.
This is true:
--Script A
local lastUpdateID = 308
local var1,var2=6,7
_G.writeDefinition(var1,var2)
function _G.writeDefinition(var1,var2)
end
I tried looking in getfenvand setfenv, but they do not show that a local variable exists. The thing is that when Script A calls writeDefinition, it lastUpdateIDincreases by one. lastUpdateIDshould remain a local variable.
EDIT: Ryan Stein's solution worked, but I ran into another problem later in the scripts.
Now it looks like this:
local f_count=1
local function sell_lox()
local sellID=5
_G.writeDefinition(sellID,sellID.." PX_lvs")
end
. , , , , SellID writeDefinition. f_count writeDefinition?