History

lua/defaults: add user_data helpers

rcombs committed 3 years ago

Commit 3fb41401 parent 0b486021 file · +19 −0Browse files

Showing the changes to player/lua/defaults.lua (1 of 1 file). Show all

Unified · Split

player/lua/defaults.lua+19−0
@@ -831,4 +831,23 @@ function mp_utils.shared_script_property_observe(name, cb) · 830 unmodified lines
831 end)831 end)
832end832end
833 833
834function mp_utils.user_data_set(path, value)
835 return mp.set_property_native("user-data/" .. path, value)
836end
837
838function mp_utils.user_data_get(path)
839 return mp.get_property_native("user-data/" .. path)
840end
841
842function mp_utils.user_data_del(path)
843 return mp.del_property_native("user-data/" .. path)
844end
845
846-- cb(name, value) on change and on init
847function mp_utils.user_data_observe(path, t, cb)
848 return mp.observe_property("user-data/" .. path, t, function(_, val)
849 cb(path, val)
850 end)
851end
852
834return {}853return {}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t