krakend / krakend-lua

a lua interpreter for the KrakenD framework
Apache License 2.0
7 stars 14 forks source link

Can't set nil for property of table #38

Closed Alex009 closed 1 month ago

Alex009 commented 1 year ago

for example i have response:

{
            "id": "123",
            "field": "dsdsd"
}

and i want to set null for field in some cases. When i try do it:

item:set("field", nil)

i not have errors, but also result not changed - i still got dsdsd

kpacha commented 1 month ago

you should use the nil helper https://github.com/krakend/krakend-lua/blob/master/types.go#L7-L13

item:set("field", luaNil.new())