Hi knorke
Thanks for your reply. The gadget part is a non-issue as the game is intended to be played internally(locally), so all players will have the gadget installed. I have no problems atm to retrieve information about what the enemy/myself have built. The problem seems to be simply that i do not have access to the io libraries. I get the following error
LuaRules::RunCallIn: error = 2, GameOver, [string "LuaRules/Gadgets/uailogger.lua"]:40: attempt to index global 'io' (a nil value)
stack traceback:
[string "LuaRules/Gadgets/uailogger.lua"]:40: in function 'writeLog'
[string "LuaRules/Gadgets/uailogger.lua"]:50: in function 'GameOver'
[string "LuaRules/gadgets.lua"]:1029: in function <[string "LuaRules/gadgets.lua"]:1027>
(tail call): ?
Just to clarify, im using the Spring:1944 mod. Could it be that io access in Gadgets is prevented by Spring or the 1944 team? Here are the relevant 2 functions
Code: Select all
function writeLog()
local replayInfo = Game.mapName .. "_" .. Game.modShortName .. "_" .. tostring(game_id) .. "_"
local file = assert( io.open("Logs\\UAILog " .. replayInfo .. ".txt", "w") )
for k,v in pairs(log) do
file:write(v)
print(v)
end
file:close()
end
function gadget:GameOver()
Spring.Echo("Shutting Down UAILogger\n")
writeLog()
end
The error occurs at io.open.