lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 6 October 2016 at 12:32, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> Looking at how strings are created this doesn't seem possible, so the
>> issue must be somewhere else. I am checking the type of the 'key'
>> parameter in the following way (in luaK_self()):
>>
>> int is_string_constant_key =
>>     key->k == VK &&
>>     isshortstr(fs, RKASK(key->u.info));
>>
>> Perhaps this is incorrect?
>
> What is 'isshortstr'?
>


Apologies for omitting that - it is a small utility function:

/**
 * Is the operand a reference to a short string constant?
 */
static int isshortstr(FuncState *fs, int kk) {
  if (ISK(kk)) {
    Proto *f = fs->f;
    kk = INDEXK(kk);
    lua_assert(kk >= 0 && kk < f->sizek);
    return ttisshrstring(&f->k[kk]);
  }
  return 0;
}