Module:InfoboxBossEnemy: Difference between revisions
From He is Coming Official Wiki
Benjiminio (talk | contribs) Created page with "-- Module:InfoboxBossEnemy local p = {} -- Function to extract the final number from a string function p.extractStat(frame, statString) local stat = statString:match("(%d+)%s*$") -- get the last number at the end return stat or 0 -- return 0 if nothing found end return p" |
Benjiminio (talk | contribs) mNo edit summary |
||
| Line 3: | Line 3: | ||
-- Function to extract the final number from a string | -- Function to extract the final number from a string | ||
function p.extractStat(frame | function p.extractStat(frame) | ||
local stat = statString:match("(%d+)%s*$") | local statString = frame.args[1] or "0" -- get the first argument safely | ||
return stat or 0 | local stat = statString:match("(%d+)%s*$") -- capture last number | ||
return stat or "0" | |||
end | end | ||
return p | return p | ||
Latest revision as of 16:41, 24 October 2025
Documentation for this module may be created at Module:InfoboxBossEnemy/doc
-- Module:InfoboxBossEnemy
local p = {}
-- Function to extract the final number from a string
function p.extractStat(frame)
local statString = frame.args[1] or "0" -- get the first argument safely
local stat = statString:match("(%d+)%s*$") -- capture last number
return stat or "0"
end
return p


