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.path Looking 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
-
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
require
lua command.Sometimes I need to use those filters, readers and writers outside their directory, like this:
If 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-dir
or--resource-path
options 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-dir
and/or--resource-path
directories: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