MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaK_setoneret

Function luaK_setoneret

lib/lua/src/lcode.c:754–765  ·  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 VRELOC (as OP_VARARG puts its results where it wants). ** (Calls are crea

Source from the content-addressed store, hash-verified

752** to be fixed.)
753*/
754void luaK_setoneret (FuncState *fs, expdesc *e) {
755 if (e->k == VCALL) { /* expression is an open function call? */
756 /* already returns 1 value */
757 lua_assert(GETARG_C(getinstruction(fs, e)) == 2);
758 e->k = VNONRELOC; /* result has fixed position */
759 e->u.info = GETARG_A(getinstruction(fs, e));
760 }
761 else if (e->k == VVARARG) {
762 SETARG_C(getinstruction(fs, e), 2);
763 e->k = VRELOC; /* can relocate its simple result */
764 }
765}
766
767
768/*

Callers 2

restassignFunction · 0.85
luaK_dischargevarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected