function luaK.addk(C,g,G,F)local a=g.L local N=g.h[G.value]local u=g.f if C:ttisnumber(N)then return C:nvalue(N)else N={}C:setnvalue(N,g.nk)g.h[G.value]=N luaY:growvector(a,u.k,g.nk,u.sizek,nil,luaP.MAXARG_Bx,"\099\111\110\115\116\097\110\116 \116\097\098\108\101 \111\118\101\114\102\108\111\119")u.k[g.nk]=F local o=g.nk g.nk=g.nk+1 return o end end

function luaK:addk(fs, k, v)
  local L = fs.L
  local idx = fs.h[k.value]
  --TValue *idx = luaH_set(L, fs->h, k); /* C */
  local f = fs.f
  if self:ttisnumber(idx) then
    --TODO this assert currently FAILS (last tested for 5.0.2)
    --assert(fs.f.k[self:nvalue(idx)] == v)
    --assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); /* C */
    return self:nvalue(idx)
  else -- constant not found; create a new entry
    idx = {}
    self:setnvalue(idx, fs.nk)
    fs.h[k.value] = idx
    -- setnvalue(idx, cast_num(fs->nk)); /* C */
    luaY:growvector(L, f.k, fs.nk, f.sizek, nil,
                    luaP.MAXARG_Bx, "constant table overflow")
    -- loop to initialize empty f.k positions not required
    f.k[fs.nk] = v
    -- setobj(L, &f->k[fs->nk], v); /* C */
    -- luaC_barrier(L, f, v); /* GC */
    local nk = fs.nk
    fs.nk = fs.nk + 1
    return nk
  end

end
