<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Разделитель разрядов в QTABLE_DOUBLE_TYPE]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Разделитель разрядов в QTABLE_DOUBLE_TYPE форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sat, 04 Apr 2026 20:41:00 +0300</pubDate>
		<item>
			<title>Разделитель разрядов в QTABLE_DOUBLE_TYPE</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message16457/topic1830/">Разделитель разрядов в QTABLE_DOUBLE_TYPE</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Ага, процесс пошёл... ))<br />Должен извиниться, в моём примере была допущена ошибка (не сразу проявилась), также слегка оптимизировал время выполнения для небольших чисел. Исправленный вариант (прежний прошу считать недействительным):<br /><table class="forum-spoiler"><thead onclick="if (this.nextSibling.style.display=='none') { this.nextSibling.style.display=''; BX.addClass(this, 'forum-spoiler-head-open'); } else { this.nextSibling.style.display='none'; BX.removeClass(this, 'forum-spoiler-head-open'); } BX.onCustomEvent('BX.Forum.Spoiler:toggle', [{node: this}]); event.stopPropagation();"><tr><th><div>Скрытый текст</div></th></tr></thead><tbody class="forum-spoiler" style="display:none;"><tr><td>function mf(data)<br /> &nbsp; &nbsp;local t=1000<br /> &nbsp; &nbsp;local n=data-data%0.01<br /> &nbsp; &nbsp;local g0=(n%1)*100<br /> &nbsp; &nbsp;local g1=(n-n%1)%t<br /> &nbsp; &nbsp;local n=data/t<br /> &nbsp; &nbsp;local g2=n-n%1<br /> &nbsp; &nbsp;if g2==0 then<br /> &nbsp; &nbsp; &nbsp; &nbsp; return string.format(&quot;%d.%02d&quot;, g1,g0)<br /> &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; n=n/t<br /> &nbsp; &nbsp; &nbsp; &nbsp; local g3=n-n%1 <br /> &nbsp; &nbsp; &nbsp; &nbsp; g2=g2%t<br /> &nbsp; &nbsp; &nbsp; &nbsp; if g3==0 then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return string.format(&quot;%d %03d.%02d&quot;, g2,g1,g0)<br /> &nbsp; &nbsp; &nbsp; &nbsp; else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;n=n/t<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local g4=n-n%1 <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;g3=g3%t<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if g4==0 then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return string.format(&quot;%d %03d %03d.%02d&quot;, g3,g2,g1,g0)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return string.format(&quot;%d %03d %03d %03d.%02d&quot;, g4,g3,g2,g1,g0)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; end<br /> &nbsp; &nbsp;end &nbsp;<br />end <br /></td></tr></tbody></table>Вроде всё работает. Всё же &quot;простая арифметика&quot; пошустрее обработки строк, хотя внешне и не столь элегантна и загадочна.)) <br />
			<i>30.05.2016 16:57:11, mikr.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message16457/topic1830/</link>
			<guid>http://forum.quik.ru/messages/forum10/message16457/topic1830/</guid>
			<pubDate>Mon, 30 May 2016 16:57:11 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Разделитель разрядов в QTABLE_DOUBLE_TYPE</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message16437/topic1830/">Разделитель разрядов в QTABLE_DOUBLE_TYPE</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<noindex><a href="http://www.bot4sale.ru/blog-menu/qlua/spisok-statej/380-split-3.html" target="_blank" rel="nofollow">Другой вариант</a></noindex> <br />
			<i>30.05.2016 13:19:12, s_mike@rambler.ru.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message16437/topic1830/</link>
			<guid>http://forum.quik.ru/messages/forum10/message16437/topic1830/</guid>
			<pubDate>Mon, 30 May 2016 13:19:12 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Разделитель разрядов в QTABLE_DOUBLE_TYPE</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message16428/topic1830/">Разделитель разрядов в QTABLE_DOUBLE_TYPE</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			&nbsp; &nbsp; Да, спасибо, действительно короткое по записи решение. Мне мозгов сразу не хватило столь эффектно с шаблонами разобраться - получалось значительно длиннее. Но изначально я пошёл иным, &quot;арифметическим&quot; путём. По записи также длиннее, но выполняется процентов на 10-15 быстрее (не критично, и всё же...): <br /><br />-- Вывод в &quot;денежном формате&quot;<br />-- (2 знака после запятой + разделитель разрядов, до 1 трлн.):<br />function mf(data)<br /> &nbsp; &nbsp; local g0=data%1000<br /> &nbsp; &nbsp; &nbsp;local n=data/1000<br /> &nbsp; &nbsp; &nbsp;local g1=(n-n%1)%1000<br /> &nbsp; &nbsp; &nbsp;n=n/1000<br /> &nbsp; &nbsp; &nbsp;local g2=(n-n%1)%1000<br /> &nbsp; &nbsp; &nbsp;n=n/1000<br /> &nbsp; &nbsp; &nbsp;local g3=(n-n%1)%1000<br /> &nbsp; &nbsp; &nbsp;if (g3==0)and(g2==0)and(g1==0) then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return string.format(&quot;%.2f&quot;, g0)<br /> &nbsp; &nbsp; &nbsp;elseif (g3==0)and(g2==0) then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return string.format(&quot;%1.f %.2f&quot;, g1, g0)<br /> &nbsp; &nbsp; &nbsp;elseif (g3==0) then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return string.format(&quot;%1.f %1.f %.2f&quot;, g2, g1, g0)<br /> &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return string.format(&quot;%1.f %1.f %1.f %.2f&quot;, g3, g2, g1, g0)<br /> &nbsp; &nbsp; &nbsp;end<br />end <br /><br />А вообще, начинающему луа-программеру вот таких простых вещей и не хватает: как циферки разделить, как табличку вывести, чтобы можно было её на место подвинуть, размерчик подогнать, и при следующем пуске она &quot;ни ногой&quot; и т. п. - то, что в &quot;купайле&quot; делалось на автомате, было скрыто от глаз пользователя. Ваш же пример в документации с вращающимися &quot;нунчаками&quot; - на мой взгляд, не слишком удачен. Ну это так, мысли вслух... Ещё раз спасибо за решение. <br />
			<i>30.05.2016 12:10:29, mikr.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message16428/topic1830/</link>
			<guid>http://forum.quik.ru/messages/forum10/message16428/topic1830/</guid>
			<pubDate>Mon, 30 May 2016 12:10:29 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Разделитель разрядов в QTABLE_DOUBLE_TYPE</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message16404/topic1830/">Разделитель разрядов в QTABLE_DOUBLE_TYPE</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Здравствуйте,<br />Автоматическая установка разделителей для QLUA таблиц не поддерживается.<br />Вы можете самостоятельно добавить разделители следующей функцией:<br />
====code====
<pre>function comma_value(n)
&nbsp;&nbsp;&nbsp;local left,num,right = string.match(n,'^(&#91;^%d&#93;*%d)(%d*)(.-)$')
&nbsp;&nbsp;&nbsp;return left..(num:reverse():gsub('(%d%d%d)','%1 '):reverse())..right
end</pre>
============= <br />
			<i>30.05.2016 07:19:02, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message16404/topic1830/</link>
			<guid>http://forum.quik.ru/messages/forum10/message16404/topic1830/</guid>
			<pubDate>Mon, 30 May 2016 07:19:02 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Разделитель разрядов в QTABLE_DOUBLE_TYPE</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message16401/topic1830/">Разделитель разрядов в QTABLE_DOUBLE_TYPE</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Разделитель разрядов (он же - &quot;сепаратор&quot; или просто &quot;пробел&quot;) в QTABLE_DOUBLE_TYPE - забыли, не захотели или не смогли? <br />
			<i>28.05.2016 19:58:40, mikr.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message16401/topic1830/</link>
			<guid>http://forum.quik.ru/messages/forum10/message16401/topic1830/</guid>
			<pubDate>Sat, 28 May 2016 19:58:40 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
