MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / lib_common_vec_operator_array_get

Function lib_common_vec_operator_array_get

src/CommonLibrary.cpp:541–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539 return bv_variable_create_void();
540 }
541 bv_variable lib_common_vec_operator_array_get(bv_program* prog, bv_object* me, u8 count, bv_variable* args)
542 {
543 bv_variable ret = bv_variable_create_void();
544
545 if (count == 1) {
546 int index = 0;
547
548 if (bv_type_is_integer(args[0].type))
549 index = bv_variable_get_int(args[0]);
550 else if (args[0].type == bv_type_float)
551 index = bv_variable_get_float(args[0]);
552
553 // TODO: how should we handle array index out of bounds?
554 if (index >= me->type->props.name_count)
555 index = me->type->props.name_count - 1;
556 if (index < 0)
557 index = 0;
558
559 ret = bv_variable_copy(me->prop[index]);
560 }
561
562 return ret;
563 }
564 bv_variable lib_common_vec_operator_array_set(bv_program* prog, bv_object* me, u8 count, bv_variable* args)
565 {
566 u8 indCount = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected