added table get

This commit is contained in:
afonya2 2025-06-03 19:51:19 +02:00
parent 4faabe0d9c
commit 9b0335e8d6
Signed by: afonya
GPG key ID: EBB9C4CAFAAFB2DC
5 changed files with 54 additions and 4 deletions

View file

@ -530,6 +530,17 @@ fn do_ast_op(ast_op: ASTPart, op_count: &mut usize, ops: &mut Vec<Operation>, va
}
return reg.register;
},
ASTPart::TableGet(tbl_get) => {
let table_reg = do_ast_op(*tbl_get.table, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers);
let key_reg = do_ast_op(*tbl_get.key, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers);
let reg = allocate_register(registers);
if reg.unbind_before {
ops.push(Operation { opcode: 8, arg1: Some(reg.register), arg2: None, arg3: None });
}
ops.push(Operation { opcode: 30, arg1: Some(table_reg), arg2: Some(key_reg as i64), arg3: Some(reg.register) });
set_register(registers, RegisterState { id: reg.register, used: true, variable: 0, last_used: *op_count });
return reg.register;
}
_ => {}
}
return 0;