-- In my main function I do the following calls:
function Main()
FBIVVoit(1,9,1,0)
FBIVVoit(1,9,1,1)
end
-- This is the function code:
function FBIVVoit(numTrain, numCar, numFBIVVoit, State)
numTrainCount = 1
while numTrainCount <= numTrain do
numCarCount = 1
while numCarCount <= numCar do
FBIVVoit = dictionary.getvalue(Dict, 'SCVSStatutsV' .. numCarCount .. '.FBIVVoit')
print('SCVSStatutsV' .. numCarCount .. '.FBIVVoit'
.. ' before the change is: ' .. FBIVVoit)
f:write(string.format('\n' .. os.date() .. ' -- ' .. 'SCVSStatutsV'
.. numCarCount .. '.FBIVVoit' .. ' before the change is: ' .. FBIVVoit))
dictionary.setvalue(Dict, 'SCVSStatutsV' .. numCarCount .. '.FBIVVoit', State);
FBIVVoit = dictionary.getvalue(Dict, 'SCVSStatutsV' .. numCarCount .. '.FBIVVoit')
print('SCVSStatutsV' .. numCarCount .. '.FBIVVoit' .. ' is now: ' .. FBIVVoit)
f:write(string.format('\n' .. os.date() .. ' -- ' .. 'SCVSStatutsV'
.. numCarCount .. '.FBIVVoit' .. ' is now: ' .. FBIVVoit))
fSleep(1)
numCarCount = numCarCount + 1
end
numTrainCount = numTrainCount + 1
end
print('Run stopped at ' .. os.date());
f:write(string.format('\n' .. os.date() .. ' -- ' .. 'Run stopped'))
f:close()
end
-- When I run the Main, the first call to the FBIVTrain function goes through without a problem. at the second call I get the following error message:
error in LUA script: c:\lua\pstm_test.lua:95: attempt to call global 'FBIVVoit' (a number value).
-- What really bugs me is that I have many other functions I call more than once in a row with different arguments passed to the function and I do not get this behavior.
-- Anyone of you ever experience that or see something wrong looking at my code? Any help would be welcomed as I am stuck there.