Searching for lua files in --data-dir and --resource-path #9598
massifrg
started this conversation in
Show and tell
Replies: 1 comment
-
|
Some further notes. Paths precedenceThe package.path = package.path .. ";" .. table.concat(luapaths, ";")If you want to search first in the paths added with package.path = table.concat(luapaths, ";") .. ";" .. package.pathLooking in the same directory of the scriptWithout specifying any path with addPathsToLuaPath({ pandoc.path.directory(PANDOC_SCRIPT_FILE) }) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I wrote some lua filters, readers and writers for Pandoc that share some common functions, so I put those functions in a base module that is loaded with the
requirelua command.Sometimes I need to use those filters, readers and writers outside their directory, like this:
pandoc -f path_to_custom_reader/custom_reader.lua \ -t path_to_custom_writer/custom_writer.lua \ -L path_to_filter/filter.lua \ document.extIf those lua files require some base lua module in their directory, pandoc can't find it and it tells you something like this (a real case of mine):
I thought that passing the path of the shared lua module with
--data-diror--resource-pathoptions would make it work, but it does not.Eventually @tarleb pointed me to the sluaggo repo where I found a section about the same problem.
This is a code you may use in your lua code that needs to load other lua files in the
--data-dirand/or--resource-pathdirectories:If you want to look for lua code in the
--resource-path, just add:If you want to look for lua code in the
--data-dir, just add:Beta Was this translation helpful? Give feedback.
All reactions