MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ListSelect

Function ListSelect

engine/Evaluator/express.cpp:626–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624}
625
626static GameValue ListSelect(const GameState* state, GameValuePar oper1, GameValuePar oper2)
627{
628 const GameArrayType& array = oper1;
629 float index = oper2;
630 int sel = toInt(index);
631 if (sel < 0 || sel >= array.Size())
632 {
633 if (sel != array.Size())
634 {
635 state->SetError(EvalDivZero);
636 }
637 return GameValue();
638 }
639 return array[sel];
640}
641
642static GameValue ListResize(const GameState* state, GameValuePar oper1, GameValuePar oper2)
643{

Callers

nothing calls this directly

Calls 4

GameValueClass · 0.70
toIntFunction · 0.50
SizeMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected