Content deleted Content added
No edit summary |
|||
Line 25:
::::Just one question about your sanitizing : local function are quicker than function in a table. So why do you declare all the functions as part of the returned <code>p</code> table ? Their name starting with underscore show that you don't expect them to be used outside this module anyway.
::::[[User:Zebulon84|Zebulon84]] ([[User talk:Zebulon84|talk]]) 16:51, 25 April 2014 (UTC)
== delinkURL sometimes fails with "Tried to write global s_decoded" if used from a module with Module:No_globals ==
{{edit template-protected}}
Hi. My apologies for using the wrong "edit template-protected". I know this is a Module, and that it is unprotected, but I think it's being used on many pages and I wasn't sure if I should make the edit myself.
My proposal is to add <code>local</code> to the s_decoded variable declaration. Specifically:
* old:
s_decoded = mw.text.decode(s, true)
* new:
local s_decoded = mw.text.decode(s, true)
Without the change, the call may fail from a module using <code>require('Module:No globals')</code>.
An example of such a module is [[Module:HS listed building]]
An example of a failed invocation is as follows:
* Go to [[Project:Sandbox]]
* Preview the following wikitext. It uses code from [[Module:Gnosygnu]]
<nowiki>{{#invoke:Gnosygnu|delink_test|[http://a.org b]}}</nowiki>
No results will be returned. Instead, the following error will be generated:
Script error<!--Lua error: Tried to write global s_decoded.-->
Let me know if you need any other info. Thanks.
[[User_talk:Gnosygnu|gnosygnu]] 23:51, 19 July 2014 (UTC)
|