Fix a couple small things

This commit is contained in:
2025-08-30 14:20:34 +10:00
parent 06ed44a010
commit e73e5a7ebc

View File

@@ -656,7 +656,7 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
saves them to a list (vector) with name listName. saves them to a list (vector) with name listName.
*/ */
case Instructions::Setlist: case Instructions::Setlist:
if (l.args.size() < 2) { if (l.args.size() < 1) {
error("Could not find all arguments required for Setlist inbuilt"); error("Could not find all arguments required for Setlist inbuilt");
} }
{ {
@@ -726,10 +726,10 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
error("Index " + to_string(ref) + " out of range of list " + listref.listName); error("Index " + to_string(ref) + " out of range of list " + listref.listName);
} }
} else { } else {
error("Unknown list: " + listref.listName); error("Found a normal variable in place of a list");
} }
} else { } else {
error("Found a normal variable in place of a list"); error("Unknown list: " + listref.listName);
} }
} }
break; break;
@@ -857,6 +857,9 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
} }
if (variables.find(listref.listName) != variables.end()) { if (variables.find(listref.listName) != variables.end()) {
if (!holds_alternative<List>(variables[listref.listName].val)) {
error("Variable " + listref.listName + "is not a list");
}
List tmpList = get<List>(variables[listref.listName].val); List tmpList = get<List>(variables[listref.listName].val);
tmpList.val.push_back(value); tmpList.val.push_back(value);
variables[listref.listName].val = tmpList; variables[listref.listName].val = tmpList;