<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://wiki.iccup.org/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3AClass%2Fdoc</id>
	<title>Модуль:Class/doc - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.iccup.org/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3AClass%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Class/doc&amp;action=history"/>
	<updated>2026-05-31T16:53:11Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Class/doc&amp;diff=202&amp;oldid=prev</id>
		<title>DarkMuse: Новая страница: «Enables equal treatment of Lua and wikicode users for modules. Using this module means you will no longer need to have two different entry points for each function—both Lua and wikicode can call the same function. ==Usage== Using this module is straightforward. Here&#039;s an example: &lt;pre&gt; local Class = require(&#039;Module:Class&#039;)                &lt;!--- Add the import local Cool = Class.new()                             &lt;!--- Create a class function Cool.doCoolStuff...»</title>
		<link rel="alternate" type="text/html" href="https://wiki.iccup.org/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Class/doc&amp;diff=202&amp;oldid=prev"/>
		<updated>2024-09-02T17:43:17Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «Enables equal treatment of Lua and wikicode users for modules. Using this module means you will no longer need to have two different entry points for each function—both Lua and wikicode can call the same function. ==Usage== Using this module is straightforward. Here&amp;#039;s an example: &amp;lt;pre&amp;gt; local Class = require(&amp;#039;Module:Class&amp;#039;)                &amp;lt;!--- Add the import local Cool = Class.new()                             &amp;lt;!--- Create a class function Cool.doCoolStuff...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Enables equal treatment of Lua and wikicode users for modules. Using this module means you will no longer need to have two different entry points for each function—both Lua and wikicode can call the same function.&lt;br /&gt;
==Usage== Using this module is straightforward. Here&amp;#039;s an example:&lt;br /&gt;
&amp;lt;pre&amp;gt; local Class = require(&amp;#039;Module:Class&amp;#039;)                &amp;lt;!--- Add the import local Cool = Class.new()                             &amp;lt;!--- Create a class function Cool.doCoolStuff(a, b)                      &amp;lt;!--- Note the colon symbol!  return a + b end return Cool.export()                            &amp;lt;!--- Export the table &amp;lt;/pre&amp;gt;&lt;br /&gt;
Now, &amp;lt;code&amp;gt;doCoolStuff&amp;lt;/code&amp;gt; can be called from both Lua and wikicode with the same arguments.&lt;br /&gt;
To illustrate, you can use &amp;lt;code&amp;gt;Cool&lt;br /&gt;
(2, 3)&amp;lt;/code&amp;gt; in Lua, and also use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke&lt;br /&gt;
|doCoolStuff|2|3}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in wikicode, and both will return 5.&lt;br /&gt;
===Named Arguments=== When named arguments are provided, there&amp;#039;s a slight change. Named arguments are supplied as a Lua table and are always the first argument. Here&amp;#039;s how:&lt;br /&gt;
&amp;lt;pre&amp;gt; local Class = require(&amp;#039;Module:Class&amp;#039;)                &amp;lt;!--- Add the import local Cool = Class.new()                             &amp;lt;!--- Create a class function Cool.doCoolStuff(args, a, b)                &amp;lt;!--- Named args are now the first argument!  return a + b + args.c end return Cool.export()                            &amp;lt;!--- Export the table &amp;lt;/pre&amp;gt;&lt;br /&gt;
You can now call &amp;lt;code&amp;gt;Cool&lt;br /&gt;
({c = 5}, 2, 3)&amp;lt;/code&amp;gt; in Lua, and similarly use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke&lt;br /&gt;
|doCoolStuff|2|3|c=5}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in wikicode, and both will return 10.&lt;br /&gt;
===Advanced Usage=== Module:Class supports advanced usage scenarios via the export function&amp;#039;s options parameter. These options are passed directly to the Module:Arguments, allowing you to specify features such as frame inheritance, trimming, and more. For more details, refer to iCCup&amp;#039;s Module&lt;br /&gt;
documentation.&lt;br /&gt;
==API== {{ApiDocStart|Class|link=Module&lt;br /&gt;
}} {{ApiDoc|export|params=class: table, options: table|description=Adjusts the provided table so that its public functions (those not prefixed with an underscore) are usable from both Lua and wikicode, and returns the modified table. Note: Avoid creating underscored versions of your public methods—use distinct names. For instance, don&amp;#039;t use both copy() and _copy() in the same module. The options parameter allows passing arguments to Module:Arguments&amp;#039;s getArgs method.|returns=class}} {{ApiDoc|new|params=base: class, init: function|description=Creates a new class by setting the proper metadata. If a base class is provided, it will be used as the base. An optional init function can act as a constructor. If only init is provided, it functions independently.|returns=class}} {{ApiDocEnd}}&lt;/div&gt;</summary>
		<author><name>DarkMuse</name></author>
	</entry>
</feed>