Can you use tables with script-opts? #16426
-
I have a script, e.g. options = {
-- Exclude these directories
excluded_paths = { },
}
local utils = require "mp.utils"
mp.options = require "mp.options" and script opts: excluded_paths={"/home/", "/media/"} But that doesn't work. Is there a way to make it work? Or do I have to format it as a string? |
Beta Was this translation helpful? Give feedback.
Answered by
guidocella
Jun 7, 2025
Replies: 2 comments
-
My current workaround is to use string formatting, then translating it to a table... script-opts: # Different values separated by | bars
excluded_paths=/home/|/media/ script: options = {
excluded_paths = "",
}
mp.options = require "mp.options"
mp.options.read_options(options)
-- Parse excluded paths
local excluded_paths = {}
for str in string.gmatch(options.excluded_paths, "([^|]+)") do
excluded_paths[#excluded_paths + 1] = str
end It works pretty well. I'd prefer to use tables directly though. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You need to use a string with separators or JSON. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Rabcor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to use a string with separators or JSON.