Ask Your Question
0

"package.prepend_path()" in Lua plugin

asked 2021-06-10 07:44:26 +0000

Roddyp gravatar image

I've seen this method mentioned in the blog post below, but it's not documented in the Wireshark Lua API?

package is a standard Lua global table, but prepend_path seems to be a non-standard addition?

Unsupported, or just an omission from the docs?

https://mika-s.github.io/wireshark/lu...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-10 14:33:06 +0000

Chuckc gravatar image

updated 2021-06-10 14:36:41 +0000

tl;dr - Change 841 - Add paths to Lua package.path so require works for user scripts

By the way, I have a comment. This package.prepend_path(NAME) function can be available for only personal plugins directory, right? (Because '__DIR__' can not be used in global plugins directory)
If so, I think it is better to be clear in the document, altough there is no document about this function yet.
But you're right it's not documented in the API docs.
I forgot the init.lua script's comments don't get scraped to generate the API docs. (we use a script to generate the docs)

I'll have to put that on my to-do list. (it's not trivial to fix that)


Notes:

It is documented (for now) in the comments inside init.lua

The Lua documentation is a combination of docbook/wsluarm.adoc and comments scraped from the source code by make-wsluarm.pl.

There was a recent (last year) issue (15404 - Lua documentation in the WSDG lacks some details compared to the wiki but doesn't look like package.prepend_path made it.

A new issue (Enhancement request) can be opened at the Wireshark Gitlab Issues page

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-06-10 07:44:26 +0000

Seen: 803 times

Last updated: Jun 10 '21