void op_3(struct script_state* st, int op) { struct script_data* data; int flag = 0; data = script_getdatatop(st, -3); script->get_val(st, data); if( data_isstring(data) ) flag = data->u.str[0];// "" -> false else if( data_isint(data) ) flag = data->u.num == 0 ? 1 : 0;// 0 -> false else { ShowError("script:op_3: invalid data for the ternary operator test\n"); script_reportdata(data); script_reportsrc(st); script_removetop(st, -3, 0); script_pushnil(st); return; } if( flag ) script_pushcopytop(st, -2); else script_pushcopytop(st, -1); script_removetop(st, -4, -1); }