emulation - BizHawk 2.1.1: read("*number") always returns 0 in Lua -
i'm trying run brilliant mar i/o artificial intelligence written in lua (more on @ https://youtu.be/qv6uvoq0f44)
the ai runs in lua (v.5.1) console of bizhawk emulator (v.2.1.1), i'm getting error when trying reload previous state of algorithm.
after opening file, seems file:read("*number") return 0, whereas read("*all") , "*line" both read content correctly. i've tried "*n" no luck.
full script at: https://pastebin.com/zzmsnahx
function loadfile(filename) local file = io.open(filename, "r") pool = newpool() pool.generation = file:read("*number") pool.maxfitness = file:read("*number") ... function writefile(filename) local file = io.open(filename, "w") file:write(pool.generation .. "\n") file:write(pool.maxfitness .. "\n") ... the file generated starts with:
18[lf] 1938[lf] ... but still, see 0s in console:
console.writeline("gen " .. pool.generation) --> "gen 0" console.writeline("max fitness " .. pool.maxfitness) --> "max fitness 0" what's puzzling script has been discussed in different forums , no 1 seems report same issue.
i found out bizhawk emulator using customized version of lua. issue appeared in version 2.1.1 of emulator. previous releases working fine.
thanks community
Comments
Post a Comment