We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7847e84 commit 9f490f1Copy full SHA for 9f490f1
src/main.rs
@@ -1109,6 +1109,20 @@ impl Executor {
1109
})
1110
}
1111
1112
+ "index" => {
1113
+ let findhint = self.pop_stack().get_string();
1114
+ let findtarget = self.pop_stack().get_list();
1115
+
1116
+ for index in 0..(findtarget.len()) {
1117
+ if findhint == findtarget[index].clone().get_string() {
1118
+ self.stack.push(Type::Number(index as f64));
1119
+ return;
1120
+ }
1121
1122
+ self.log_print(String::from("Error! item not found in this list").as_str().to_owned() + "\n");
1123
+ self.stack.push(Type::Error(String::from("item-not-found")));
1124
1125
1126
// If it is not recognized as a command, use it as a string.
1127
_ => self.stack.push(Type::String(command)),
1128
0 commit comments