summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-26 22:32:57 +0100
committerwm4 <wm4@nowhere>2014-02-26 22:32:57 +0100
commit15134935602a546103a26f4b3ecc72da25896f09 (patch)
tree4eed0a52a150e8f13814d271b1da55e439285d8e /player/lua
parent5eab4f43ec562e4ea37943b5360475a9d6d9c83d (diff)
downloadmpv-15134935602a546103a26f4b3ecc72da25896f09.tar.bz2
mpv-15134935602a546103a26f4b3ecc72da25896f09.tar.xz
lua: mark table values returned by get_property_native with their type
Lua doesn't distinguish between arrays and maps on the language level; there are just tables. Use metatables to mark these tables with their actual types. In particular, it allows distinguishing empty arrays from empty tables.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/defaults.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index f8fe05ff82..0a04e26761 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -1,4 +1,11 @@
-mp.UNKNOWN_TYPE = "this value is inserted if the C type is not supported"
+mp.UNKNOWN_TYPE.info = "this value is inserted if the C type is not supported"
+mp.UNKNOWN_TYPE.type = "UNKNOWN_TYPE"
+
+mp.ARRAY.info = "native array"
+mp.ARRAY.type = "ARRAY"
+
+mp.MAP.info = "native map"
+mp.MAP.type = "MAP"
function mp.get_script_name()
return mp.script_name