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

Function luaK_goiftrue

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

** Emit code to go through if 'e' is true, jump otherwise. */

Source from the content-addressed store, hash-verified

862** Emit code to go through if 'e' is true, jump otherwise.
863*/
864void luaK_goiftrue (FuncState *fs, expdesc *e) {
865 int pc; /* pc of new jump */
866 luaK_dischargevars(fs, e);
867 switch (e->k) {
868 case VJMP: { /* condition? */
869 negatecondition(fs, e); /* jump when it is false */
870 pc = e->u.info; /* save jump position */
871 break;
872 }
873 case VK: case VKFLT: case VKINT: case VTRUE: {
874 pc = NO_JUMP; /* always true; do nothing */
875 break;
876 }
877 default: {
878 pc = jumponcond(fs, e, 0); /* jump when false */
879 break;
880 }
881 }
882 luaK_concat(fs, &e->f, pc); /* insert new jump in false list */
883 luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */
884 e->t = NO_JUMP;
885}
886
887
888/*

Callers 3

condFunction · 0.85
test_then_blockFunction · 0.85
luaK_infixFunction · 0.85

Calls 5

luaK_dischargevarsFunction · 0.85
negateconditionFunction · 0.85
jumponcondFunction · 0.85
luaK_concatFunction · 0.85
luaK_patchtohereFunction · 0.85

Tested by 1

test_then_blockFunction · 0.68