First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

"package.prepend_path()" in Lua plugin

  • retag add tags

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...

Roddyp's avatar
1
Roddyp
asked 2021-06-10 07:44:26 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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

Chuckc's avatar
3k
Chuckc
answered 2021-06-10 14:33:06 +0000, updated 2021-06-10 14:36:41 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer