Le 29/09/2017 à 16:16, Brad Jorsch (Anomie) a écrit :
On Fri, Sep 29, 2017 at 7:05 AM, mathieu stumpf guntz < psychoslave@culture-libre.org> wrote:
Well, it's nothing functionally important, but I was wondering what the "p" initial was for, as it's used everywhere as the returned value by modules.
"package", I believe.
At least it seems relevant, thank you.
As noted, nothing actually requires that the variable be named "p", that's just the convention. For that matter, nothing requires the variable even exist. You could have a module return the method table directly, like
return { hello = function () return "Hello, world!" end }
and that would be valid. But for a long module that might get hard to read, and wouldn't allow one method to call another if necessary.
Yes, I was aware of that, but thank you to take time to explain it clearly again.
On Fri, Sep 29, 2017 at 7:40 AM, mathieu stumpf guntz < psychoslave@culture-libre.org> wrote:
Where? In the reference manual, it's `p` which is used. Should it be updated with `_module`?
But I'm affraid that could lead to confusion for beginners when the console require to use `p`. What about alliasing `p` with `_module`, and even `m` in the scribunto console?
Let's not overcomplicate everything. If someone would rather use "_module" or "m" in the console, they can always enter "_module = p" or the like before starting their testing.
That's right and now that I have some word to match with the initialism, I'm fine with p.