WripWrath
WripWrath

Reputation: 71

Random Error From Node.Js and Lua HTTP Get?

So I'm trying to recieve data like the clients IP from a pipedream workflow using lua(HTTPGET). And so I have a custom body response in Node.JS with no errors. However, when I print the body response in Lua I get this unusual error. It prints the ip but then says A malformed number is near the clients ip.:

My Node.JS code for pipedream:

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

There are no errors, its fine but heres my Lua code to get the response:

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

GetServProtocal()

Also, no errors but the output is weird:

-- 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"

Upvotes: 0

Views: 163

Answers (1)

Paul Kulchenko
Paul Kulchenko

Reputation: 26754

Remove loadstring from your code. The loadstring function expects some Lua code, which it will turn into an executable function and the string that is being returned by HttpGet is not a valid Lua code, hence the error you get.

Upvotes: 1

Related Questions