/resty/moongoo/utils.lua:19: attempt to call field 'uint' (a nil value)
stack traceback:
coroutine 0:
/Users/dong/develop/lua/ldas/resty/moongoo/utils.lua: in function 'uint_to_hex'
/Users/dong/develop/lua/ldas/resty/moongoo/utils.lua:40: in function 'generate_oid'
/Users/dong/develop/lua/ldas/resty/moongoo/collection.lua:67: in function 'ensure_oids'
/Users/dong/develop/lua/ldas/resty/moongoo/collection.lua:96: in function 'insert'
local function uint_to_hex(num, len, be) local len = len or 4 local be = be or 0 **local num = cbson.uint(num)** local raw = cbson.uint_to_raw(num, len, be) local out = '' for i = 1, #raw do out = out .. string.format("%02x", raw:byte(i,i)) end return out end
1) format your message properly, with code tags
2) be sure to use latest non-modified versions of lua-cbson and lua-resty-moongoo
3) provide minimal test code
/resty/moongoo/utils.lua:19: attempt to call field 'uint' (a nil value) stack traceback: coroutine 0: /Users/dong/develop/lua/ldas/resty/moongoo/utils.lua: in function 'uint_to_hex' /Users/dong/develop/lua/ldas/resty/moongoo/utils.lua:40: in function 'generate_oid' /Users/dong/develop/lua/ldas/resty/moongoo/collection.lua:67: in function 'ensure_oids' /Users/dong/develop/lua/ldas/resty/moongoo/collection.lua:96: in function 'insert'
local function uint_to_hex(num, len, be) local len = len or 4 local be = be or 0 **local num = cbson.uint(num)** local raw = cbson.uint_to_raw(num, len, be) local out = '' for i = 1, #raw do out = out .. string.format("%02x", raw:byte(i,i)) end return out end
how to solve?