MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaK_setoneret

Function luaK_setoneret

depends/lua/src/lcode.c:539–550  ·  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

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

Callers 2

assignmentFunction · 0.85
luaK_dischargevarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected