/* Ensures final expression result is in a valid R/K index (that is, it is either in a register or in 'k' with an index in the range of R/K indices). Returns R/K index.  */
int luaK_exp2RK(FuncState *fs, expdesc *e)
/* Ensures final expression result is in a valid R/K index (that is, it is either in a register or in 'k' with an index in the range of R/K indices). Returns R/K index.  */
int luaK_exp2RK(FuncState *fs, expdesc *e)
{
    case VTRUE: e->u.info = boolK(fs, 1); goto vk;
    case VFALSE: e->u.info = boolK(fs, 0); goto vk;
    case VNIL: e->u.info = nilK(fs); goto vk;
    case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk;
    case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk;
    case VK:
     vk:
      e->k = VK;
      if (e->u.info <= MAXINDEXRK)
        return RKASK(e->u.info);
      else break;
    default: break;
  }
  return luaK_exp2anyreg(fs, e);
}