<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="vi">
	<id>https://bktt.vn/index.php?action=history&amp;feed=atom&amp;title=M%C3%B4_%C4%91un%3AIf_preview</id>
	<title>Mô đun:If preview - Lịch sử thay đổi</title>
	<link rel="self" type="application/atom+xml" href="https://bktt.vn/index.php?action=history&amp;feed=atom&amp;title=M%C3%B4_%C4%91un%3AIf_preview"/>
	<link rel="alternate" type="text/html" href="https://bktt.vn/index.php?title=M%C3%B4_%C4%91un:If_preview&amp;action=history"/>
	<updated>2026-05-19T16:48:23Z</updated>
	<subtitle>Lịch sử thay đổi của trang này ở wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://bktt.vn/index.php?title=M%C3%B4_%C4%91un:If_preview&amp;diff=478&amp;oldid=prev</id>
		<title>Tttrung: Tạo trang mới với nội dung “local p = {}  --[[ main  This function returns the either the first argument or second argument passed to this module, depending on whether it is being pr…”</title>
		<link rel="alternate" type="text/html" href="https://bktt.vn/index.php?title=M%C3%B4_%C4%91un:If_preview&amp;diff=478&amp;oldid=prev"/>
		<updated>2020-10-02T11:15:41Z</updated>

		<summary type="html">&lt;p&gt;Tạo trang mới với nội dung “local p = {}  --[[ main  This function returns the either the first argument or second argument passed to this module, depending on whether it is being pr…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Trang mới&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
main&lt;br /&gt;
&lt;br /&gt;
This function returns the either the first argument or second argument passed to this module, depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|main|value_if_preview|value_if_not_preview}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local result = ''&lt;br /&gt;
	Preview_mode = frame:preprocess('{{REVISIONID}}');							-- use magic word to get revision id&lt;br /&gt;
	if not (Preview_mode == nil or Preview_mode == '') then										-- if there is a value then this is not a preiview&lt;br /&gt;
		result = frame.args[2] or '';&lt;br /&gt;
	else&lt;br /&gt;
		result = frame.args[1] or '';									-- no value (nil or empty string) so this is a preview&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
pmain&lt;br /&gt;
&lt;br /&gt;
This function returns the either the first argument or second argument passed to this module's parent (i.e. template using this module), depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|pmain}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.pmain(frame)&lt;br /&gt;
	return p.main(frame:getParent())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
boolean&lt;br /&gt;
&lt;br /&gt;
This function returns the either true or false, depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|boolean}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.boolean(frame)&lt;br /&gt;
	local result = ''&lt;br /&gt;
	Preview_mode = frame:preprocess('{{REVISIONID}}');							-- use magic word to get revision id&lt;br /&gt;
	if not (Preview_mode == nil or Preview_mode == '') then										-- if there is a value then this is not a preiview&lt;br /&gt;
		result = false;&lt;br /&gt;
	else&lt;br /&gt;
		result = true;									-- no value (nil or empty string) so this is a preview&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Tttrung</name></author>
	</entry>
</feed>