How to I parse JSON in space lua?
js.stringify
does the opposite. But how to convert a string containing JSON into a lua table?
Context: I run a command via shell.run
that prints JSON on stdout
How to I parse JSON in space lua?
js.stringify
does the opposite. But how to convert a string containing JSON into a lua table?
Context: I run a command via shell.run
that prints JSON on stdout
I may add a nicer way, but there’s js.window.JSON.parse(...)
right now.
Yes, you can access any JS API via js.window
but don’t tell anybody.
Heh thanks for the hint.
I am currently migrating this script from JS to lua. Funny that I now have to use JS again
js.window.JSON.parse(s)
leads to „Attempting to index a nil value“ error.
Seems like js.window
is nil
I am running 0.10.04. my code is in a space script block in the run function of a command.define call
Ok yeah, this is only implemented in v2.