fix off-by-one error in GameVars::normalize_varname()

This commit is contained in:
yuni 2024-06-12 00:59:07 +02:00
parent 0c622f28ab
commit 9e121cf633

View file

@ -564,7 +564,7 @@ impl GameVars {
} else if parts.len() > 1 {
// we got a key with at least one "$"
// extract anything before the last "$":
let scope_part: String = parts[0..parts.len() - 2].join(SCOPE_SEPARATOR);
let scope_part: String = parts[0..parts.len() - 1].join(SCOPE_SEPARATOR);
if scope_part.is_empty() {
// we got a key like "$foo", just prefix the fallback scope