[Wikimedia-l] Scribunto/Lua : how to call a local wiki module within a module
Mathieu Stumpf
psychoslave at culture-libre.org
Tue Apr 2 13:46:24 UTC 2013
Hello,
Sorry for the noise, but I didn't know where to post this. Please point
me any place more appropriate for this kind of topic if you know one.
So, I begin to play with Lua, trying to rewrite piece a software which
take a digit ([0-9]*) in input, and provide a "how you spell/pronounce
it" string in various languages in output. Well, that's not a
transcendent goal, but I think it's a good way to learn this new tool.
Now that I have a minimal piece of functions (but nothing close to even
a single language decent support), I wanted to make a unit tests page.
But I'm blocked, because I don't find how to call my main module within
my test module. For those interested, pages are there :
https://fr.wiktionary.org/wiki/Module:Pr0n
https://fr.wiktionary.org/wiki/Module:Pr0n/test
https://fr.wiktionary.org/wiki/Utilisateur:Psychoslave/test_pr0n
And the relevant part are:
pron = require( "Module:Pr0n" )
for i=0,99 do
pron.ortho(i) -- fail!
end
Here is the error message:
Erreur Lua dans Module:Pr0n à la ligne 37: attempt to index local
'frame' (a number value).
Trace arrière:
Module:Pr0n:37 : dans la fonction « ortho »
Module:Pr0n/test:8 : dans la fonction « chunk »
mw.lua:463 : dans la fonction « chunk »
--
Association Culture-Libre
http://www.culture-libre.org/
More information about the Wikimedia-l
mailing list