https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AEntrypoint Module:Entrypoint - Revision history 2025-05-30T07:33:54Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:Entrypoint&diff=1258489916&oldid=prev Awesome Aasim at 01:02, 20 November 2024 2024-11-20T01:02:58Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:02, 20 November 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 5:</td> <td colspan="2" class="diff-lineno">Line 5:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @script entrypoint</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @script entrypoint</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>-- @release <del style="font-weight: bold; text-decoration: none;">stable</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>-- @release <ins style="font-weight: bold; text-decoration: none;">beta</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @author [[wikia:dev:User:8nml|8nml]] (Fandom Dev Wiki)</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @author [[wikia:dev:User:8nml|8nml]] (Fandom Dev Wiki)</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @param {table} package Scribunto package.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @param {table} package Scribunto package.</div></td> </tr> </table> Awesome Aasim https://en.wikipedia.org/w/index.php?title=Module:Entrypoint&diff=1258489788&oldid=prev Awesome Aasim at 01:02, 20 November 2024 2024-11-20T01:02:09Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:02, 20 November 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 6:</td> <td colspan="2" class="diff-lineno">Line 6:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @script entrypoint</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @script entrypoint</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @release stable</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @release stable</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>-- @author [[User:8nml|8nml]]</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>-- @author [[<ins style="font-weight: bold; text-decoration: none;">wikia:dev:</ins>User:8nml|8nml]]<ins style="font-weight: bold; text-decoration: none;"> (Fandom Dev Wiki)</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @param {table} package Scribunto package.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @param {table} package Scribunto package.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @error[85] {string} 'you must specify a function to call'</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @error[85] {string} 'you must specify a function to call'</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 29:</td> <td colspan="2" class="diff-lineno">Line 29:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @return[opt] {number} Next index.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @return[opt] {number} Next index.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @return[opt] {number|string|table|boolean} Next value.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- @return[opt] {number|string|table|boolean} Next value.</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>-- @see <del style="font-weight: bold; text-decoration: none;">[[github</del>:lua/lua/blob/v5.1.1/lbaselib.c#L247<del style="font-weight: bold; text-decoration: none;">]]</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>-- @see <ins style="font-weight: bold; text-decoration: none;">https</ins>:<ins style="font-weight: bold; text-decoration: none;">//github.com/</ins>lua/lua/blob/v5.1.1/lbaselib.c#L247</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local inext = select(1, ipairs{})</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local inext = select(1, ipairs{})</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> Awesome Aasim https://en.wikipedia.org/w/index.php?title=Module:Entrypoint&diff=1247642030&oldid=prev Awesome Aasim: based on wikia:dev:Module:Entrypoint 2024-09-25T06:35:44Z <p>based on <a href="https://community.fandom.com/wiki/w:c:dev:Module:Entrypoint" class="extiw" title="wikia:dev:Module:Entrypoint">wikia:dev:Module:Entrypoint</a></p> <p><b>New page</b></p><div>--- Entrypoint templating wrapper for Scribunto packages.<br /> -- The module generates an entrypoint function that can execute Scribunto<br /> -- package calls in the template context. This allows a package to support<br /> -- both direct and template invocations.<br /> -- <br /> -- @script entrypoint<br /> -- @release stable<br /> -- @author [[User:8nml|8nml]]<br /> -- @param {table} package Scribunto package.<br /> -- @error[85] {string} &#039;you must specify a function to call&#039;<br /> -- @error[91] {string} &#039;the function you specified did not exist&#039;<br /> -- @error[opt,95] {string} &#039;$2 is not a function&#039;<br /> -- @return {function} Template entrypoint - @{main}.<br /> -- @note Parent frames are not available in Entrypoint&#039;s<br /> -- `frame`. This is because recursive (grandparent)<br /> -- frame access is impossible in legacy Scribunto<br /> -- due to [[mw:Manual:Parser#Empty-argument expansion<br /> -- cache|empty-argument expansion cache]] limitations.<br /> -- @note As Entrypoint enables template access rather than<br /> -- a new extension hook, it does not work with named<br /> -- numeric parameters such as `1=` or `2=`. This may<br /> -- result in unexpected behaviour such as Entrypoint<br /> -- and module errors.<br /> <br /> --- Stateless, sequential Lua iterator.<br /> -- @function inext<br /> -- @param {table} t Invariant state to loop over.<br /> -- @param {number} i Control variable (current index).<br /> -- @return[opt] {number} Next index.<br /> -- @return[opt] {number|string|table|boolean} Next value.<br /> -- @see [[github:lua/lua/blob/v5.1.1/lbaselib.c#L247]]<br /> local inext = select(1, ipairs{})<br /> <br /> --- Check for MediaWiki version 1.25.<br /> -- The concurrent Scribunto release adds a type check for package functions.<br /> -- @variable {boolean} func_check<br /> -- @see [[mw:MediaWiki 1.24/wmf7#Scribunto]]<br /> local func_check = tonumber(mw.site.currentVersion:match(&#039;^%d+.%d+&#039;)) &gt;= 1.25<br /> <br /> --- MediaWiki error message getter.<br /> -- Mimics Scribunto error formatting for script errors. <br /> -- @function msg<br /> -- @param {string} key MediaWiki i18n message key.<br /> -- @param[opt] {string} fn_name Name of package function.<br /> -- @return {string} Formatted lowercase message.<br /> -- @local<br /> local function msg(key, fn_name)<br /> return select(1, mw.message.new(key)<br /> :plain()<br /> :match(&#039;:%s*(.-)[.۔。෴։።]?$&#039;)<br /> :gsub(&#039;^.&#039;, mw.ustring.lower)<br /> :gsub(&#039;$2&#039;, fn_name or &#039;$2&#039;)<br /> )<br /> end<br /> <br /> --- Template entrypoint function generated by this module.<br /> -- @function main<br /> -- @param {Frame} frame Scribunto frame in module context.<br /> -- @return {string} Module output in template context.<br /> return function(package) return function(f)<br /> local frame = f:getParent()<br /> <br /> local args_mt = {}<br /> local arg_cache = {}<br /> <br /> args_mt.__pairs = function()<br /> return next, arg_cache, nil<br /> end<br /> args_mt.__ipairs = function()<br /> return inext, arg_cache, 0<br /> end<br /> args_mt.__index = function(t, k)<br /> return arg_cache[k]<br /> end<br /> <br /> for key, val in pairs(frame.args) do<br /> arg_cache[key] = val<br /> end<br /> local fn_name = table.remove(arg_cache, 1)<br /> <br /> f.args = setmetatable({}, args_mt)<br /> frame.args = setmetatable({}, args_mt)<br /> <br /> if not fn_name then<br /> error(msg(&#039;scribunto-common-nofunction&#039;))<br /> end<br /> <br /> fn_name = mw.text.trim(fn_name)<br /> <br /> if not package[fn_name] then<br /> error(msg(&#039;scribunto-common-nosuchfunction&#039;, fn_name))<br /> end<br /> <br /> if func_check and type(package[fn_name]) ~= &#039;function&#039; then<br /> error(msg(&#039;scribunto-common-notafunction&#039;, fn_name))<br /> end<br /> <br /> return package[fn_name](frame)<br /> end end</div> Awesome Aasim