我将 openresty/1.7.7.2 与 Lua 5.1.4 一起使用。我收到int64的请求,我将它的字符串格式保存在数据库中(无法更改数据库架构或请求格式)。我无法匹配他们两个。
local i = 913034578410143848 --request
local p = "913034578410143848" -- stored in DB
print(p==tostring(i)) -- return false
print(i%10) -- return 0 ..this also doesn't work
如果可能的话,有没有办法将 int64 转换为字符串,反之亦然?
更新:
我i
从 protobuf 对象中获取。proto 文件描述i
为 int64。我正在使用pb4lua
protobuf 库。
ngx.req.read_body()
local body = ngx.req.get_body_data()
local request, err = Request:load(body)
local i = request.id