diff options
author | wm4 <wm4@nowhere> | 2015-04-22 20:55:05 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-04-22 20:55:05 +0200 |
commit | daabbe364007fc7546df63981422b53b9a20c6fc (patch) | |
tree | 44a2ab9c1d7fc02efeac374862a4f0e8829cff91 /DOCS/man/lua.rst | |
parent | 589533d97ad0bf861a555b7402410297541bf96c (diff) | |
download | mpv-daabbe364007fc7546df63981422b53b9a20c6fc.tar.bz2 mpv-daabbe364007fc7546df63981422b53b9a20c6fc.tar.xz |
lua: add utils.format_json() function
Requested. Why not.
Diffstat (limited to 'DOCS/man/lua.rst')
-rw-r--r-- | DOCS/man/lua.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/DOCS/man/lua.rst b/DOCS/man/lua.rst index 4700b90cb2..ff70600a1d 100644 --- a/DOCS/man/lua.rst +++ b/DOCS/man/lua.rst @@ -639,6 +639,14 @@ strictly part of the guaranteed API. trailing text is returned as 3rd return value. (The 3rd return value is always there, but with ``trail`` set, no error is raised.) +``utils.format_json(v)`` + Format the given Lua table (or value) as a JSON string and return it. On + error, returns ``nil, error``. (Errors usually only happen on value types + incompatible with JSON.) + + The argument value uses similar conventions as ``mp.set_property_native()`` + to distinguish empty objects and arrays. + ``utils.to_string(v)`` Turn the given value into a string. Formats tables and their contents. This doesn't do anything special; it is only needed because Lua is terrible. |