Closed Ptitlaby closed 4 years ago
Hello,
I encountered an issue where I was unable to use the script if the map have tag names which include unicode characters.
When creating the autorun.lua script, you end up with text like that :
["text"] = "\u00c0 d\u00e9truire", ["last_user"] = "ptitlaby", ["force"] = "player"
which can't be parsed by lua as far as it seems.
I found a workaround for my case, modifying the file auto.py around the step "building autorun.lua" :
auto.py
Old code :
mapInfoLua = re.sub(r'"([^"]+)" *:', lambda m: '["'+m.group(1)+'"] = ', f.read().replace("[", "{").replace("]", "}"))
New code :
mapInfoLuaJSON = json.loads(f.read()) mapInfoLua = json.dumps(mapInfoLuaJSON, ensure_ascii=False) mapInfoLua = re.sub(r'"([^"]+)" *:', lambda m: '["'+m.group(1)+'"] = ',mapInfoLua.replace("[", "{").replace("]", "}"))
I'm not sure how good this work around is
Hello,
I encountered an issue where I was unable to use the script if the map have tag names which include unicode characters.
When creating the autorun.lua script, you end up with text like that :
which can't be parsed by lua as far as it seems.
I found a workaround for my case, modifying the file
auto.py
around the step "building autorun.lua" :Old code :
New code :
I'm not sure how good this work around is