summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-28 23:18:50 +0100
committerwm4 <wm4@nowhere>2014-11-29 00:03:46 +0100
commit3295caca3d21b20ccab19ab3420d07a139b4f200 (patch)
treeb75ff7040553c889a9e98c84fc862765a148f963 /TOOLS
parent9666d48aa332a034d7df72aee320385fb549464d (diff)
downloadmpv-3295caca3d21b20ccab19ab3420d07a139b4f200.tar.bz2
mpv-3295caca3d21b20ccab19ab3420d07a139b4f200.tar.xz
lua: add a function that formats Lua values as strings
Yep, Lua is so crappy that the stdlib doesn't provide anything like this. Repurposes the undocumented mp.format_table() function and moves it to mp.utils.
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/lua/observe-all.lua10
1 files changed, 2 insertions, 8 deletions
diff --git a/TOOLS/lua/observe-all.lua b/TOOLS/lua/observe-all.lua
index 68e09773c6..9bfdf44992 100644
--- a/TOOLS/lua/observe-all.lua
+++ b/TOOLS/lua/observe-all.lua
@@ -1,16 +1,10 @@
-- Test script for property change notification mechanism.
-function format_property_val(v)
- if type(v) == "table" then
- return mp.format_table(v) -- undocumented function; might be removed
- else
- return tostring(v)
- end
-end
+local utils = require("mp.utils")
for i,name in ipairs(mp.get_property_native("property-list")) do
mp.observe_property(name, "native", function(name, val)
print("property '" .. name .. "' changed to '" ..
- format_property_val(val) .. "'")
+ utils.to_string(val) .. "'")
end)
end