MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaK_setoneret

Function luaK_setoneret

libraries/AP_Scripting/lua/src/lcode.c:546–557  ·  view source on GitHub ↗

** Fix an expression to return one result. ** If expression is not a multi-ret expression (function call or ** vararg), it already returns one result, so nothing needs to be done. ** Function calls become VNONRELOC expressions (as its result comes ** fixed in the base register of the call), while vararg expressions ** become VRELOCABLE (as OP_VARARG puts its results where it wants). ** (Calls are

Source from the content-addressed store, hash-verified

544** to be fixed.)
545*/
546void luaK_setoneret (FuncState *fs, expdesc *e) {
547 if (e->k == VCALL) { /* expression is an open function call? */
548 /* already returns 1 value */
549 lua_assert(GETARG_C(getinstruction(fs, e)) == 2);
550 e->k = VNONRELOC; /* result has fixed position */
551 e->u.info = GETARG_A(getinstruction(fs, e));
552 }
553 else if (e->k == VVARARG) {
554 SETARG_B(getinstruction(fs, e), 2);
555 e->k = VRELOCABLE; /* can relocate its simple result */
556 }
557}
558
559
560/*

Callers 2

assignmentFunction · 0.85
luaK_dischargevarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected