<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://firestone-idle-rpg.de/Modul:Utility/history?feed=atom</id>
	<title>Modul:Utility - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://firestone-idle-rpg.de/Modul:Utility/history?feed=atom"/>
	<link rel="alternate" type="text/html" href="https://firestone-idle-rpg.de/Modul:Utility/history"/>
	<updated>2026-05-24T18:38:01Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Firestone Idle RPG Wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://firestone-idle-rpg.de/index.php?title=Modul:Utility&amp;diff=84&amp;oldid=prev</id>
		<title>Webmaster am 23. Oktober 2023 um 23:06 Uhr</title>
		<link rel="alternate" type="text/html" href="https://firestone-idle-rpg.de/index.php?title=Modul:Utility&amp;diff=84&amp;oldid=prev"/>
		<updated>2023-10-23T23:06:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 24. Oktober 2023, 01:06 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l192&quot;&gt;Zeile 192:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 192:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;--: (string) Prints out nowiki of first argument&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;--: (string) Prints out nowiki of first argument&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;function p.nowiki (frame)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;function p.nowiki (frame)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;     local args = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;require(&quot;Module:Arguments&quot;)&lt;/del&gt;.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;getArgs(frame)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;     local args = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;frame&lt;/ins&gt;.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;args&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;     return mw.text.nowiki (args[1] )&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;     return mw.text.nowiki (args[1] )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Webmaster</name></author>
	</entry>
	<entry>
		<id>https://firestone-idle-rpg.de/index.php?title=Modul:Utility&amp;diff=82&amp;oldid=prev</id>
		<title>Webmaster: Die Seite wurde neu angelegt: „--&lt;pre&gt; // --| A library with many miscellaneous functions p = {}  --% Put all arguments into a real table - Returns Parent, child args table --@ frame (table) A frame object --@ targetArgs (string) the target arguments to return, possible values (&quot;parent&quot;, &quot;child&quot;, &quot;both&quot; --: (table) A table containing arguments function p.getArgs(frame, targetArgs)     if frame and type(frame)==&quot;table&quot; then         local tParent = frame:getParent()         local tChild…“</title>
		<link rel="alternate" type="text/html" href="https://firestone-idle-rpg.de/index.php?title=Modul:Utility&amp;diff=82&amp;oldid=prev"/>
		<updated>2023-10-23T22:44:17Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „--&amp;lt;pre&amp;gt; // --| A library with many miscellaneous functions p = {}  --% Put all arguments into a real table - Returns Parent, child args table --@ frame (table) A frame object --@ targetArgs (string) the target arguments to return, possible values (&amp;quot;parent&amp;quot;, &amp;quot;child&amp;quot;, &amp;quot;both&amp;quot; --: (table) A table containing arguments function p.getArgs(frame, targetArgs)     if frame and type(frame)==&amp;quot;table&amp;quot; then         local tParent = frame:getParent()         local tChild…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&amp;lt;pre&amp;gt; //&lt;br /&gt;
--| A library with many miscellaneous functions&lt;br /&gt;
p = {}&lt;br /&gt;
&lt;br /&gt;
--% Put all arguments into a real table - Returns Parent, child args table&lt;br /&gt;
--@ frame (table) A frame object&lt;br /&gt;
--@ targetArgs (string) the target arguments to return, possible values (&amp;quot;parent&amp;quot;, &amp;quot;child&amp;quot;, &amp;quot;both&amp;quot;&lt;br /&gt;
--: (table) A table containing arguments&lt;br /&gt;
function p.getArgs(frame, targetArgs)&lt;br /&gt;
    if frame and type(frame)==&amp;quot;table&amp;quot; then&lt;br /&gt;
        local tParent = frame:getParent()&lt;br /&gt;
        local tChild = p.fetchArgs(frame.args or nil)&lt;br /&gt;
        &lt;br /&gt;
        if frame   then&lt;br /&gt;
            tParent = p.fetchArgs(tParent.args or nil)&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if targetArgs ==&amp;quot;parent&amp;quot; then&lt;br /&gt;
            return tParent&lt;br /&gt;
        elseif targetArgs ==&amp;quot;child&amp;quot; then&lt;br /&gt;
            return tChild&lt;br /&gt;
        elseif targetArgs ==&amp;quot;both&amp;quot; then&lt;br /&gt;
            return tParent, tChild&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        return tParent or tChild&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
--% This is meant to fetch a args table&lt;br /&gt;
--@ tTmp (table) The template args from the module {{#invoke&lt;br /&gt;
--: (table) A table containing arguments  or nil&lt;br /&gt;
function p.fetchArgs(tTmp)&lt;br /&gt;
    if not(tTmp) then &lt;br /&gt;
        return &lt;br /&gt;
    end&lt;br /&gt;
    for name, value in  pairs( tTmp ) do&lt;br /&gt;
        if(name) then&lt;br /&gt;
            -- This is meant to avoid a read-only meta-table with no table functions&lt;br /&gt;
            return mw.clone(tTmp)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Check if args are enough for script to run&lt;br /&gt;
--@ frame (table) Scribunto frame object&lt;br /&gt;
--@ iArgs (number) Number of arguments required to run checkArgs&lt;br /&gt;
--@ bParent (boolean) Checks parent (true) or child arguments &lt;br /&gt;
--: (boolean) True if args are enough for script to run&lt;br /&gt;
function p.checkArgs(frame, iArgs, bParent)&lt;br /&gt;
    local iCount =0&lt;br /&gt;
    local  tParent, tChild = p.getArgs(frame)&lt;br /&gt;
    local tArgTable = tParent&lt;br /&gt;
&lt;br /&gt;
    if not(bParent) then&lt;br /&gt;
        tArgTable = tChild&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    for name, value in  pairs(tArgTable) do &lt;br /&gt;
        iCount = iCount + 1&lt;br /&gt;
        if (iCount) == tonumber(iArgs) then  &lt;br /&gt;
            return true      &lt;br /&gt;
        end      &lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Add days to date&lt;br /&gt;
--@ sDate (string) Date string e.g. 2012-01-02, YYYY-MM-DD&lt;br /&gt;
--@ iDays (number) Number of days to add or subtract (negative or positive)&lt;br /&gt;
--@ bReturnTable (boolean) Set to true to returns a lua date table&lt;br /&gt;
--@ sFormat (string) specific format for date &lt;br /&gt;
--: (string) A calculated date&lt;br /&gt;
function p.addDays(sDate,iDays,bReturnTable, sFormat)&lt;br /&gt;
    if p.checkdate(sDate) and iDays and tonumber(iDays) then&lt;br /&gt;
        local iDayToSecs = iDays  * 24 * 60 *60&lt;br /&gt;
        &lt;br /&gt;
        if (bReturnTable) then&lt;br /&gt;
            return os.date(&amp;quot;*t&amp;quot;,p.getdate(sDate,sFormat) + iDayToSecs)&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        return os.date(&amp;quot;%Y-%m-%d&amp;quot;,p.getdate(sDate,sFormat) + iDayToSecs)&lt;br /&gt;
    end&lt;br /&gt;
    return sDate&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Check if date is in appropriate format --Iso YYYY-MM-DD&lt;br /&gt;
--@ sDate (string) Date string e.g. 2012-01-02, YYYY-MM-DD&lt;br /&gt;
--@ sPat (string) A lua pattern for a date, default is (%d%d%d%d)-(%d%d)-(%d%d)&lt;br /&gt;
--: (boolean) True for valid date&lt;br /&gt;
&lt;br /&gt;
function p.checkdate(sDate, sPat)&lt;br /&gt;
    if sDate then&lt;br /&gt;
        local sPat = sPat or &amp;quot;(%d%d%d%d)-(%d%d)-(%d%d)&amp;quot;&lt;br /&gt;
        local year, month, day = sDate:match(sPat)&lt;br /&gt;
        &lt;br /&gt;
        if year and month and day then &lt;br /&gt;
            return true&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Check if table is empty&lt;br /&gt;
--@ tTab (table) A valid table&lt;br /&gt;
--: (boolean) true for empty&lt;br /&gt;
function p.isempty(tTab)&lt;br /&gt;
    if next(tTab) == nil then&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Round a number&lt;br /&gt;
--@ num (number) A number&lt;br /&gt;
--@ idp (number) Decimal points&lt;br /&gt;
--: (number) Rounded number &lt;br /&gt;
&lt;br /&gt;
function p.round(num, idp)&lt;br /&gt;
    return tonumber(string.format(&amp;quot;%.&amp;quot; .. (idp or 0) .. &amp;quot;f&amp;quot;, num))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Calculate difference between two dates&lt;br /&gt;
--@ sDate1 (string) A string containing a date&lt;br /&gt;
--@ sDate2 (string) A string containing a date&lt;br /&gt;
--@ isAbsolute (boolean) absolute number (no negatives)&lt;br /&gt;
--: (number) Difference between days number or null&lt;br /&gt;
function p.datediff( sDate1, sDate2, isAbsolute)&lt;br /&gt;
    if p.checkdate(sDate1) and p.checkdate(sDate2) then&lt;br /&gt;
        sDate1 = string.sub(sDate1,0,10)&lt;br /&gt;
        sDate2 = string.sub(sDate2,0,10)&lt;br /&gt;
        local tDate1 =p.getdate(sDate1)&lt;br /&gt;
        local tDate2 =p.getdate(sDate2)&lt;br /&gt;
        local iDays = (os.difftime(tDate1,tDate2))/3600/24&lt;br /&gt;
        &lt;br /&gt;
        if isAbsolute then&lt;br /&gt;
            iDays = math.abs(iDays)&lt;br /&gt;
        end&lt;br /&gt;
        return iDays&lt;br /&gt;
    end&lt;br /&gt;
    -- return 0&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--% Get lua timestamp (os.time) using custom format&lt;br /&gt;
--@ sDate (string) A string containing a date&lt;br /&gt;
--@ sPat (string) A lua pattern, default: &amp;quot;(%d%d%d%d)-(%d%d)-(%d%d)&amp;quot;&lt;br /&gt;
--: (table) Lua os.time&lt;br /&gt;
function p.getdate(sDate,sPat)&lt;br /&gt;
    if not(sDate) then &lt;br /&gt;
        sDate = os.date(&amp;quot;%Y-%m-%d&amp;quot;) &lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local sPat=sPat or &amp;quot;(%d%d%d%d)-(%d%d)-(%d%d)&amp;quot;&lt;br /&gt;
    local year,month,day=sDate:match(sPat)&lt;br /&gt;
    local tDate &lt;br /&gt;
    &lt;br /&gt;
    if year and month and day then&lt;br /&gt;
       tDate = os.time({month=month,year=year,day=day}) &lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return tDate&lt;br /&gt;
end&lt;br /&gt;
--% Get a printed table&lt;br /&gt;
--@ tablename (table) A simple lua table&lt;br /&gt;
--: (string) A printed lua table&lt;br /&gt;
function p.table_print (tablename)&lt;br /&gt;
    return require(&amp;quot;Module:Inspect&amp;quot;).inspect(tablename)&lt;br /&gt;
end&lt;br /&gt;
--% Gets debug information for a function  using lua xpcall&lt;br /&gt;
--@ oFunc (function) A function to debug&lt;br /&gt;
--@ bShowErr (boolean) True to show error&lt;br /&gt;
--: (string) A stacktrace containing error details&lt;br /&gt;
function p.debug(oFunc, bShowErr)&lt;br /&gt;
     local bStatus, bResults = xpcall(oFunc, debug.traceback)&lt;br /&gt;
     &lt;br /&gt;
     if (not(bShowErr) or bStatus) then&lt;br /&gt;
        return bResults&lt;br /&gt;
     end&lt;br /&gt;
end&lt;br /&gt;
--% Gets variable content &lt;br /&gt;
--@ oData (variable) A variable to output information (e.g. a table {})&lt;br /&gt;
--: (string) Prints out variable content&lt;br /&gt;
function p.log(oData)&lt;br /&gt;
    local sOutput = oData&lt;br /&gt;
    if type(oData)==&amp;quot;table&amp;quot; then&lt;br /&gt;
        sOutput = p.table_print(oData,4) &lt;br /&gt;
    end&lt;br /&gt;
    mw.log(sOutput)&lt;br /&gt;
    return sOutput&lt;br /&gt;
end&lt;br /&gt;
--% Performs a nowiki on content. Same as using mw.text.nowiki on the first argument.&lt;br /&gt;
--@ frame (table) Scribunto frame&lt;br /&gt;
--: (string) Prints out nowiki of first argument&lt;br /&gt;
function p.nowiki (frame)&lt;br /&gt;
    local args = require(&amp;quot;Module:Arguments&amp;quot;).getArgs(frame)&lt;br /&gt;
    return mw.text.nowiki (args[1] )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;br /&gt;
-- [[Category:Lua modules]]&lt;/div&gt;</summary>
		<author><name>Webmaster</name></author>
	</entry>
</feed>