| 734 | return bv_variable_create_void(); |
| 735 | } |
| 736 | bv_variable lib_common_mat_operator_array_get(bv_program* prog, bv_object* me, u8 count, bv_variable* args) |
| 737 | { |
| 738 | bv_variable ret = bv_variable_create_void(); |
| 739 | sd::Matrix* myData = (sd::Matrix*)me->user_data; |
| 740 | |
| 741 | if (count == 1) { |
| 742 | int index = 0; |
| 743 | |
| 744 | if (bv_type_is_integer(args[0].type)) |
| 745 | index = bv_variable_get_int(args[0]); |
| 746 | else if (args[0].type == bv_type_float) |
| 747 | index = bv_variable_get_float(args[0]); |
| 748 | |
| 749 | // TODO: how should we handle array index out of bounds? |
| 750 | if (index >= me->type->props.name_count) |
| 751 | index = me->type->props.name_count - 1; |
| 752 | if (index < 0) |
| 753 | index = 0; |
| 754 | |
| 755 | ret = create_vec(prog, myData->Type, myData->Rows); |
| 756 | |
| 757 | bv_object* retObj = bv_variable_get_object(ret); |
| 758 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 759 | retObj->prop[i] = bv_variable_cast(myData->Type, bv_variable_create_float(myData->Data[index][i])); |
| 760 | } |
| 761 | |
| 762 | return ret; |
| 763 | } |
| 764 | bv_variable lib_common_mat_operator_array_set(bv_program* prog, bv_object* me, u8 count, bv_variable* args) |
| 765 | { |
| 766 | u8 argCount = count; |
nothing calls this directly
no test coverage detected