<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Как экономнее написать код]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Как экономнее написать код форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sun, 03 May 2026 14:26:56 +0300</pubDate>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message24006/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Но ошибку эту я никому не скажу <br />
			<i>24.04.2017 17:35:28, swerg.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message24006/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message24006/topic2732/</guid>
			<pubDate>Mon, 24 Apr 2017 17:35:28 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23983/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			====code====
<pre>local t=container&#91;sec&#93;; --это таблица цен по данному инструменту local len=#t -- это текущее количество цен в контейнере 
local n=len-N; if n&#60;1 then n=1; end -- это номер первого из N значений цен т е Ваши цены в t&#91;n&#93; до t&#91;len&#93;&nbsp;&nbsp;</pre>
=============
Большая буква N - это сколько последних свечек я хочу брать для анализа? То есть аналог моей переменной how_many_candles?<br />сразу как вы выложили свой вариант функции 
====code====
<pre>function mycallbackforallstocks(class,sec,index)&nbsp;&nbsp;&nbsp;&nbsp;
if container==nil then container={} end&nbsp;&nbsp; 
if container&#91;sec&#93;==nil then container&#91;sec&#93;={} end 
-----------------------------&nbsp;&nbsp; 
local close=ds&#91;sec&#93;:C(index)&nbsp;&nbsp; 
local open=ds&#91;sec&#93;:O(index)&nbsp;&nbsp; 
local high=ds&#91;sec&#93;:H(index)&nbsp;&nbsp; 
local low=ds&#91;sec&#93;:L(index)&nbsp;&nbsp; 
container&#91;sec&#93;&#91;index&#93;=(close+open+high+low)/4 
end </pre>
=============
я её испробовал, но она не работает. Код вылетает с ошибкой нил на строчке<br />sintez_table&#91;x&#93;=temp_t&#91;x&#93;/temp_tt&#91;x&#93; <br />
			<i>23.04.2017 14:38:39, Let_it_go.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23983/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23983/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 14:38:39 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23981/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_hjADLmO2" href="/user/3905/" bx-tooltip-user-id="3905">Let_it_go</a> написал:<br />Спасибо, Николай.<br />Я хочу получить таблицу-контейнер, в которой будут храниться цены за последние how_many_candles свечей (how_many_candles-пользовательская переменная, например равная 50). В контейнер будет записываться типическая цена (Typical).<br />Всё это нужно для создания синтетических инструментов и их анализа. Я хочу получить значение пары GAZP/SBER: сколько сберов надо отдать за 1 Газпром, получить по GAZP/SBER цены за &nbsp;how_many_candles свечей и эти данные загнать в индикаторы Сергея Горохова INDICATORS.ZIP. Например посчитать RSI по паре GAZP/SBER<br />Вопрос о финальной стадии &quot;запихивания&quot; я задал в этой ветке. <br /> <noindex><a href="https://forum.quik.ru/forum10/topic2733/" target="_blank" rel="nofollow">https://forum.quik.ru/forum10/topic2733/</a></noindex> <br />Что то не клеится при расчёте RSI. Вот весь код, который на данный момент сырой и глючный.<br />
====code====
<pre> </pre>
=============
<br />=============<br />Про контейнер<br />В приведенном мною варианте Вы получите<br /> таблицу container&#91;sec&#93; в которй будут все ваши цены<br />далее вы просто берете от конца этой таблицы нужное вам число значений<br />т е <br />делаем так<br /><br />
====code====
<pre>local t=container&#91;sec&#93;; --это таблица цен по данному инструменту
local len=#t -- это текущее количество цен в контейнере
local n=len-N; if n&#60;1 then n=1; end -- это номер первого из N значений цен т е Ваши цены в t&#91;n&#93; до t&#91;len&#93;

</pre>
=============
Теперь про индикатор<br />Я бы не использовал функции из INDICATORS.ZIP, по той причине, что они слишком универсальны и следовательно громоздкие.<br />Я использую обычно один из следующих вариантов:<br />1) использую встроенную RSI и читаю значения с графика, когда лень или нет надобности в 2).<br />2) беру &nbsp;формулу и пишу функцию под задачу без излишеств. <br />
			<i>23.04.2017 12:25:02, Николай  Камынин.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23981/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23981/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 12:25:02 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23977/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Вот что пишется в лог: RSI первые 15 итераций нил, и только с 15 он получает какое то значение<br />lll - это три &quot;л&quot; - переменная итератор<br /><br /><img src="https://content.screencast.com/users/astro-12/folders/Snagit/media/223973d4-9843-479e-9c4a-0b5b16d58990/04.23.2017-11.32.png" alt="Пользователь добавил изображение" border="0" /> <br />
			<i>23.04.2017 11:33:42, Let_it_go.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23977/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23977/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 11:33:42 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23975/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Спасибо, Николай.<br />Я хочу получить таблицу-контейнер, в которой будут храниться цены за последние how_many_candles свечей (how_many_candles-пользовательская переменная, например равная 50). В контейнер будет записываться типическая цена (Typical).<br />Всё это нужно для создания синтетических инструментов и их анализа. Я хочу получить значение пары GAZP/SBER: сколько сберов надо отдать за 1 Газпром, получить по GAZP/SBER цены за &nbsp;how_many_candles свечей и эти данные загнать в индикаторы Сергея Горохова INDICATORS.ZIP. Например посчитать RSI по паре GAZP/SBER<br />Вопрос о финальной стадии &quot;запихивания&quot; я задал в этой ветке. <br /><noindex><a href="https://forum.quik.ru/forum10/topic2733/" target="_blank" rel="nofollow">https://forum.quik.ru/forum10/topic2733/</a></noindex><br />Что то не клеится при расчёте RSI. Вот весь код, который на данный момент сырой и глючный.<br />
====code====
<pre>function OnInit ()
&nbsp;&nbsp;&nbsp;&nbsp;class_code="TQBR" 
&nbsp;&nbsp;&nbsp;&nbsp;interval=INTERVAL_M5 --интервал
&nbsp;&nbsp;&nbsp;&nbsp;how_many_candles=50
&nbsp;&nbsp;&nbsp;&nbsp;ticker_list="GAZP,SBER,VTBR"
&nbsp;&nbsp;&nbsp;&nbsp;ds={}
&nbsp;&nbsp;&nbsp;&nbsp;num_candles={}
&nbsp;&nbsp;&nbsp;&nbsp;line_count_table={}&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;container={}
&nbsp;&nbsp;&nbsp;&nbsp;is_run = true
&nbsp;&nbsp;&nbsp;&nbsp;dofile ("C:&#92;&#92;Program Files&#92;&#92;Lua&#92;&#92;5.1&#92;&#92;lua&#92;&#92;2.lua") --читаем индикатор RSI
end

function OnStop(s)
&nbsp;&nbsp;&nbsp;&nbsp;is_run = false
&nbsp;&nbsp;&nbsp;&nbsp;return 100
end

function mycallbackforallstocks(class,sec,index) 
&nbsp;&nbsp;&nbsp;&nbsp;num_candles&#91;sec&#93;=ds&#91;sec&#93;:Size() 
&nbsp;&nbsp;&nbsp;&nbsp;if index==num_candles&#91;sec&#93; then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i=0, how_many_candles do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local close_price=ds&#91;sec&#93;:C(num_candles&#91;sec&#93;-i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local open_price=ds&#91;sec&#93;:O(num_candles&#91;sec&#93;-i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local high_price=ds&#91;sec&#93;:H(num_candles&#91;sec&#93;-i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local low_price=ds&#91;sec&#93;:L(num_candles&#91;sec&#93;-i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local typical_price=(close_price+open_price+high_price+low_price)/4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.insert(container&#91;sec&#93;,i,typical_price)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;end

end

function DataSource(class,sec,interval)
&nbsp;&nbsp; ds&#91;sec&#93; = CreateDataSource(class_code,sec,interval)
&nbsp;&nbsp; ds&#91;sec&#93;:SetUpdateCallback(function(...) mycallbackforallstocks(class_code,sec,...) end)
&nbsp;&nbsp; return ds&#91;sec&#93;
end

function main()
&nbsp;&nbsp;&nbsp;&nbsp;for sec in string.gmatch(ticker_list,"%a+") do&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;container&#91;sec&#93;={}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DataSource(class_code,sec,interval)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;while is_run do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for sec in string.gmatch(ticker_list,"%a+") do&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep (10000)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for second_sec in string.gmatch(ticker_list,"%a+") do&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sintez_table={}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rsi_count&#91;lll&#93;=func(lll, {Period=15, VType="Any"}, sintez_table)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;end
end </pre>
============= <br />
			<i>23.04.2017 11:13:31, Let_it_go.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23975/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23975/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 11:13:31 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23972/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_It0aTfSp" href="/user/3905/" bx-tooltip-user-id="3905">Let_it_go</a> написал:<br /><I><br /><br />====quote====<br />function mycallbackforallstocks(class,sec,index) <br /><br /> &nbsp; &nbsp;local num_candles=ds&#91;sec&#93;:Size() <br /> &nbsp; &nbsp;if index==num_candles then &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;container&#91;sec&#93;={}<br /> &nbsp; &nbsp; &nbsp; &nbsp;for i=0, how_many_candles do<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local close_price=ds&#91;sec&#93;:C(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local open_price=ds&#91;sec&#93;:O(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local high_price=ds&#91;sec&#93;:H(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local low_price=ds&#91;sec&#93;:L(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local typical_price=(close_price+open_price+high_price+low_price)/4<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;container&#91;sec&#93;.<I>=typical_price &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;end<br />end</I><br />=============<br /></I><br />=============<br />Можно как-то так:<br />
====code====
<pre>function mycallbackforallstocks(class,sec,index) 
&nbsp;&nbsp;if container==nil then container={} end
&nbsp;&nbsp;if container&#91;sec&#93;==nil then container&#91;sec&#93;={} end
-----------------------------
&nbsp;&nbsp;local close=ds&#91;sec&#93;:C(index)
&nbsp;&nbsp;local open=ds&#91;sec&#93;:O(index)
&nbsp;&nbsp;local high=ds&#91;sec&#93;:H(index)
&nbsp;&nbsp;local low=ds&#91;sec&#93;:L(index)
&nbsp;&nbsp;container&#91;sec&#93;&#91;index&#93;=(close+open+high+low)/4
end
</pre>
============= <br />
			<i>23.04.2017 10:22:15, Николай  Камынин.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23972/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23972/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 10:22:15 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23971/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			А что в итоге хотите получить? <br />
			<i>23.04.2017 10:15:04, Николай  Камынин.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23971/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23971/topic2732/</guid>
			<pubDate>Sun, 23 Apr 2017 10:15:04 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как экономнее написать код</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message23968/topic2732/">Как экономнее написать код</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день.<br />Подскажите пожалуйста как записать этот код без создания лишней таблицы s<br />====quote====<br />function mycallbackforallstocks(class,sec,index) <br /><br /> &nbsp; &nbsp;local num_candles=ds&#91;sec&#93;:Size() <br /> &nbsp; &nbsp;if index==num_candles then &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;container&#91;sec&#93;={}<br /><B><span class="bx-font" style="color:#ff0000"> &nbsp; &nbsp;s=container&#91;sec&#93;</span></B><br /> &nbsp; &nbsp; &nbsp; &nbsp;for i=0, how_many_candles do<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local close_price=ds&#91;sec&#93;:C(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local open_price=ds&#91;sec&#93;:O(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local high_price=ds&#91;sec&#93;:H(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local low_price=ds&#91;sec&#93;:L(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local typical_price=(close_price+open_price+high_price+low_price)/4<br /><B><span class="bx-font" style="color:#ff0000"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s&#91;i&#93;=typical_price &nbsp; &nbsp;</span></B><br /> &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;end<br />end<br />=============<br /><br />Я пытался записать в таком виде, но код не работает.<br /><br />====quote====<br />function mycallbackforallstocks(class,sec,index) <br /><br /> &nbsp; &nbsp;local num_candles=ds&#91;sec&#93;:Size() <br /> &nbsp; &nbsp;if index==num_candles then &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;container&#91;sec&#93;={}<br /> &nbsp; &nbsp; &nbsp; &nbsp;for i=0, how_many_candles do<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local close_price=ds&#91;sec&#93;:C(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local open_price=ds&#91;sec&#93;:O(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local high_price=ds&#91;sec&#93;:H(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local low_price=ds&#91;sec&#93;:L(num_candles-i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local typical_price=(close_price+open_price+high_price+low_price)/4<br /><B><span class="bx-font" style="color:#ff0000"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;container&#91;sec&#93;.&#91;i&#93;=typical_price &nbsp; &nbsp;</span></B><br /> &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp;end<br />end<br />=============<br /><br />Спасибо заранее <br />
			<i>22.04.2017 23:00:08, Let_it_go.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message23968/topic2732/</link>
			<guid>http://forum.quik.ru/messages/forum10/message23968/topic2732/</guid>
			<pubDate>Sat, 22 Apr 2017 23:00:08 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
