【问题标题】:Random Error From Node.Js and Lua HTTP Get?来自 Node.Js 和 Lua HTTP Get 的随机错误?
【发布时间】:2021-10-05 15:30:47
【问题描述】:

所以我正在尝试使用 lua(HTTPGET) 从 pipedream 工作流中接收客户端 IP 等数据。所以我在 Node.JS 中有一个没有错误的自定义正文响应。但是,当我在 Lua 中打印正文响应时,我得到了这个不寻常的错误。它打印了 ip,但随后说 A malformed number is near the clients ip.:

我的 Pipedream 的 Node.JS 代码:

await $respond({
  status: 200,
  immediate: true,
  body: `${steps.trigger.event.client_ip}`
})

没有错误,很好,但这是我的 Lua 代码以获得响应:

function GetServProtocal()
    print(loadstring(game:HttpGet('https://enznhjjype22xb2.m.pipedream.net')))()
end

GetServProtocal()

此外,没有错误,但输出很奇怪:

-- I'm using 1.1.1.1 example ip for code so I don't expose my real one.

[string "1.1.1.1"]:1: malformed number near "1.1.1.1"

【问题讨论】:

    标签: node.js lua pipedream


    【解决方案1】:

    从您的代码中删除 loadstringloadstring 函数需要一些 Lua 代码,它将变成可执行函数,而 HttpGet 返回的字符串不是有效的 Lua 代码,因此会出现错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-21
      • 1970-01-01
      • 2012-12-09
      • 2012-10-23
      • 2015-11-04
      • 1970-01-01
      相关资源
      最近更新 更多