Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: module function instead of require #2254

Closed
wants to merge 1 commit into from
Closed

doc: module function instead of require #2254

wants to merge 1 commit into from

Conversation

decadence
Copy link

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

Isn't module an old form of requiring modules?

@lynch1981
Copy link
Contributor

You can add doc: prefix to the title to fix Lint error ;)

@decadence decadence changed the title module function instead of require doc: module function instead of require Nov 12, 2023
@zhuizhuhaomeng
Copy link
Contributor

@decadence where did you get the old style?
From the stackoverflow, the original doc is right.
https://stackoverflow.com/questions/7248877/in-lua-how-do-you-import-modules

@decadence
Copy link
Author

@zhuizhuhaomeng it is listed in the text after that:

The Lua module is actually loaded by the first Nginx request handler and is cached by the require() built-in in the package.loaded table for later reference, and the module() builtin used by some Lua modules has the side effect of setting a global variable to the loaded module table

Yes, I think I got it mixed up. module is used inside the module file itself, and not when module is required.

@decadence decadence closed this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants