John Smith commited on 2021-357 12:38:04
Showing 2 changed files, with 2 additions and 2 deletions.
Lua's `str:gsub(pattern, repl)` interprets `%` as a sort of escape character in `repl`, so the presence of a `%` in answer text would cause an error or undefined behaviour.
| ... | ... |
@@ -137,7 +137,7 @@ elseif action == "r" then |
| 137 | 137 |
io.read("l")
|
| 138 | 138 |
io.write(string.format( |
| 139 | 139 |
"%s\nDid you get it? ", |
| 140 |
- pst:gsub("%%A", pr.ans)
|
|
| 140 |
+ pst:gsub("%%A", pr.ans:gsub("%%", "%%%%"))
|
|
| 141 | 141 |
)) |
| 142 | 142 |
local resp = io.read("l")
|
| 143 | 143 |
review.update(deck[ip[1]][ip[2]], st, isyes(resp)) |