Toggle menu
9
205
64
18.8K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 23:51, 15 February 2025 by Prd (talk | contribs) (Created page with "local p = {} function p.main(frame) local count = 500 while pcall(mw.incrementExpensiveFunctionCount) do count = count - 1 end if count == 500 then count = 'at least 500' end return '<span style="color:yellow;background-color:red">There are ' .. count .. ' expensive function calls before this point</span><span style="display:none">http://www.encyclopediadramatica.com</span>' -- Hidden dead link to blacklisted site prevents accidental saving end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Subpages:

This module is weird: it's not meant to be used, just previewed. The purpose is to find out how many expensive function calls appear before a given point within a page. That helps people to examine where the problem is in long, complicated pages and tables.

To prevent saving this by accident, the module creates a link to a blacklisted site (one which no longer exists) which is not displayed, but trips the blacklist warning if Save is pressed. And if you manage to save it anyway, the count isn't accurate (usually 0) and the page shows up in Category:Pages with too many expensive parser function calls, so don't.


Usage

{{#invoke:Preview expense|main}} entered in the preview window.

Parameters

None

Simulated sample output

There are 31 expensive function calls before this point



local p = {}

function p.main(frame)
	local count = 500
	while pcall(mw.incrementExpensiveFunctionCount) do
		count = count - 1
	end
	if count == 500 then
		count = 'at least 500'
	end
	return '<span style="color:yellow;background-color:red">There are ' .. count .. ' expensive function calls before this point</span><span style="display:none">http://www.encyclopediadramatica.com</span>' -- Hidden dead link to blacklisted site prevents accidental saving
end

return p