<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Case &#187; lua</title>
	<atom:link href="http://case.net.ru/tag/lua/feed/" rel="self" type="application/rss+xml" />
	<link>http://case.net.ru</link>
	<description>Just another technical weblog</description>
	<lastBuildDate>Sun, 29 Jan 2012 08:48:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Verlihub: отключаем поиск акадовцам</title>
		<link>http://case.net.ru/2009/02/19/verlihub/</link>
		<comments>http://case.net.ru/2009/02/19/verlihub/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 19:54:38 +0000</pubDate>
		<dc:creator>Case</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[verlihub]]></category>

		<guid isPermaLink="false">http://case.net.ru/?p=272</guid>
		<description><![CDATA[Дабы не грузить исходящий канал бесполезными запросами на поиск от акадовцев, пишем небольшой lua скрипт: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 [...]]]></description>
			<content:encoded><![CDATA[<p>Дабы не грузить исходящий канал бесполезными запросами на поиск от акадовцев, пишем небольшой lua скрипт:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="lua" style="font-family:monospace;">aRange <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;127.0.0.1-127.0.0.255&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.128.0.1-10.128.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.129.0.1-10.129.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.130.0.1-10.130.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;192.168.0.1-192.168.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;213.79.108.1-213.79.111.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;172.16.127.1-172.16.127.255&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">function</span> VH_OnParsedMsgSearch<span style="color: #66cc66;">&#40;</span>nick,data<span style="color: #66cc66;">&#41;</span>
&nbsp;
    res, myinfo <span style="color: #66cc66;">=</span> VH:GetMyINFO<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
    _, _, sharess <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>myinfo,<span style="color: #ff0000;">&quot;(%d+)$$&quot;</span><span style="color: #66cc66;">&#41;</span>
    _, ip <span style="color: #66cc66;">=</span> VH:GetUserIP<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #b1b100;">local</span> Allow,Range <span style="color: #66cc66;">=</span> Func.CheckIP<span style="color: #66cc66;">&#40;</span>GetIP<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Allow <span style="color: #66cc66;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
        VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, data: &quot;</span>..data..<span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>
    <span style="color: #b1b100;">else</span>
        VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, data: &quot;</span>..data..<span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #b1b100;">end</span>
<span style="color: #b1b100;">end</span>
&nbsp;
Func <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
Func.ComIP <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> _,_,a,b,c,d <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>curIP, <span style="color: #ff0000;">&quot;(%d+).(%d+).(%d+).(%d+)&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">return</span> a<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">16777216</span> + b<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">65536</span> + c<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">256</span> + d
<span style="color: #b1b100;">end</span>
&nbsp;
Func.CheckIP <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> _,_,a,b,c,d <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>curIP, <span style="color: #ff0000;">&quot;(%d*).(%d*).(%d*).(%d*)&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
        <span style="color: #b1b100;">local</span> UserIP <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">if</span> UserIP <span style="color: #b1b100;">then</span>
            <span style="color: #b1b100;">for</span> Range, Table <span style="color: #b1b100;">in</span> <span style="color: #b1b100;">pairs</span><span style="color: #66cc66;">&#40;</span>aRange<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">do</span>
                <span style="color: #b1b100;">local</span> _,_,R1,R2 <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>Range, <span style="color: #ff0000;">&quot;(%S+)-(%S+)&quot;</span><span style="color: #66cc66;">&#41;</span>
                Range1 <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>R1<span style="color: #66cc66;">&#41;</span>
                Range2 <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>R2<span style="color: #66cc66;">&#41;</span>
                <span style="color: #b1b100;">if</span> UserIP <span style="color: #66cc66;">&gt;=</span> Range1 <span style="color: #b1b100;">and</span> UserIP <span style="color: #66cc66;">&lt;=</span> Range2 <span style="color: #b1b100;">then</span>
                    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>,Range
                <span style="color: #b1b100;">end</span>
            <span style="color: #b1b100;">end</span>
        <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #b1b100;">function</span> GetIP<span style="color: #66cc66;">&#40;</span>sNick<span style="color: #66cc66;">&#41;</span>
    res, ip <span style="color: #66cc66;">=</span> VH:GetUserIP<span style="color: #66cc66;">&#40;</span>sNick<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">return</span> ip
<span style="color: #b1b100;">end</span></pre></td></tr></table></div>

<p>Кладем скрипт в файл /usr/local/etc/verlihub/scripts/search.lua и в чате dc набираем команду:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">!</span>luaload <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>verlihub<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>search.lua</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://case.net.ru/2009/02/19/verlihub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Установка Verlihub с поддержкой Lua</title>
		<link>http://case.net.ru/2009/02/06/verlihub-lua/</link>
		<comments>http://case.net.ru/2009/02/06/verlihub-lua/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 19:22:41 +0000</pubDate>
		<dc:creator>Case</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[verlihub]]></category>

		<guid isPermaLink="false">http://case.net.ru/?p=232</guid>
		<description><![CDATA[Устанавливаем из портов net-p2p/verlihub и net-p2p/verlihub-plugins-luascript. Ложим скрипты в каталог /usr/local/etc/verlihub/scripts. В DC используем следующие команды: !luaload /usr/local/etc/verlihub/scripts/file.lua !luaunload /usr/local/etc/verlihub/scripts/file.lua !luareload /usr/local/etc/verlihub/scripts/file.lua Мой первый бот: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [...]]]></description>
			<content:encoded><![CDATA[<p>Устанавливаем из портов net-p2p/verlihub и net-p2p/verlihub-plugins-luascript.<br />
Ложим скрипты в каталог /usr/local/etc/verlihub/scripts.<br />
В DC используем следующие команды:<br />
!luaload /usr/local/etc/verlihub/scripts/file.lua<br />
!luaunload /usr/local/etc/verlihub/scripts/file.lua<br />
!luareload /usr/local/etc/verlihub/scripts/file.lua</p>
<p>Мой первый бот:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
</pre></td><td class="code"><pre class="lua" style="font-family:monospace;">aRange <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;127.0.0.1-127.0.0.255&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.128.0.1-10.128.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.129.0.1-10.129.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;10.130.0.1-10.130.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;192.168.0.1-192.168.255.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;213.79.108.1-213.79.111.254&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;172.16.127.1-172.16.127.255&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>,
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--function VH_OnParsedMsgChat(nick, data)</span>
<span style="color: #b1b100;">function</span> VH_OnUserLogin<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">--  if (string.find(data,&quot;^/me%s&quot;)) then</span>
    res, myinfo <span style="color: #66cc66;">=</span> VH:GetMyINFO<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
    _, _, sharess <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>myinfo,<span style="color: #ff0000;">&quot;(%d+)$$&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">--      _, _, action = string.find(data,&quot;^/me%s+(.+)&quot;)</span>
    _, ip <span style="color: #66cc66;">=</span> VH:GetUserIP<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #b1b100;">local</span> Allow,Range <span style="color: #66cc66;">=</span> Func.CheckIP<span style="color: #66cc66;">&#40;</span>GetIP<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> res,class <span style="color: #66cc66;">=</span> VH:GetUserClass<span style="color: #66cc66;">&#40;</span>nick<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--if (Allow == 0) and (res and class &lt;= 2)</span>
<span style="color: #808080; font-style: italic;">--VH:SendDataToUser(&quot;$To: sNick From: $&lt;&quot;..sBotName..&quot;&gt; nForbidden. Your IP: &quot;..ip..&quot; is not inside LocalNetwork |&quot;, sNick)</span>
&nbsp;
    shares <span style="color: #66cc66;">=</span> sharess <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">1024</span><span style="color: #66cc66;">;</span>
    _, _, share <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>shares,<span style="color: #ff0000;">&quot;^(%d*)&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>class <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>sharess<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">53687091200</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Allow <span style="color: #66cc66;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
<span style="color: #808080; font-style: italic;">--              VH:SendDataToAll(&quot;** &quot;..nick..&quot; disconnect wrong user, nothing share|&quot;,5,10);</span>
                VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, akado (&quot;</span>..ip..<span style="color: #ff0000;">&quot;), low share (&quot;</span>..share..<span style="color: #ff0000;">&quot;), disconnect|&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #b1b100;">else</span>
<span style="color: #808080; font-style: italic;">--              VH:SendDataToAll(&quot;** &quot;..nick..&quot; share something normal user|&quot;,5,10);</span>
                VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, zelcom (&quot;</span>..ip..<span style="color: #ff0000;">&quot;), low share (&quot;</span>..share..<span style="color: #ff0000;">&quot;), alive|&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #b1b100;">end</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #808080; font-style: italic;">--  VH:SendDataToAll(&quot;** &quot;..nick..&quot; welcome aboard, normal share user|&quot;,5,10);</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>Allow <span style="color: #66cc66;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
                VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, akado (&quot;</span>..ip..<span style="color: #ff0000;">&quot;), normal share (&quot;</span>..share..<span style="color: #ff0000;">&quot;), alive|&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #b1b100;">else</span>
                VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, zelcom (&quot;</span>..ip..<span style="color: #ff0000;">&quot;), normal share (&quot;</span>..share..<span style="color: #ff0000;">&quot;), alive|&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #b1b100;">end</span>
        <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">else</span>
        VH:SendDataToUser<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$To: Case From: Verlihub $&lt;VerliHub&gt; user: &quot;</span>..nick..<span style="color: #ff0000;">&quot;, operator, alive|&quot;</span>, <span style="color: #ff0000;">&quot;Case&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">--      VH:SendDataToAll(&quot;** &quot;..nick..&quot; welcome aboard, operator|&quot;,5,10);</span>
    <span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--  end</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>
<span style="color: #b1b100;">end</span>
&nbsp;
Func <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
Func.ComIP <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> _,_,a,b,c,d <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>curIP, <span style="color: #ff0000;">&quot;(%d+).(%d+).(%d+).(%d+)&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">return</span> a<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">16777216</span> + b<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">65536</span> + c<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">256</span> + d
<span style="color: #b1b100;">end</span>
&nbsp;
Func.CheckIP <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> _,_,a,b,c,d <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>curIP, <span style="color: #ff0000;">&quot;(%d*).(%d*).(%d*).(%d*)&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
        <span style="color: #b1b100;">local</span> UserIP <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>curIP<span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">if</span> UserIP <span style="color: #b1b100;">then</span>
            <span style="color: #b1b100;">for</span> Range, Table <span style="color: #b1b100;">in</span> <span style="color: #b1b100;">pairs</span><span style="color: #66cc66;">&#40;</span>aRange<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">do</span>
                <span style="color: #b1b100;">local</span> _,_,R1,R2 <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.find</span><span style="color: #66cc66;">&#40;</span>Range, <span style="color: #ff0000;">&quot;(%S+)-(%S+)&quot;</span><span style="color: #66cc66;">&#41;</span>
                Range1 <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>R1<span style="color: #66cc66;">&#41;</span>
                Range2 <span style="color: #66cc66;">=</span> Func.ComIP<span style="color: #66cc66;">&#40;</span>R2<span style="color: #66cc66;">&#41;</span>
                <span style="color: #b1b100;">if</span> UserIP <span style="color: #66cc66;">&gt;=</span> Range1 <span style="color: #b1b100;">and</span> UserIP <span style="color: #66cc66;">&lt;=</span> Range2 <span style="color: #b1b100;">then</span>
                    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>,Range
                <span style="color: #b1b100;">end</span>
            <span style="color: #b1b100;">end</span>
        <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #b1b100;">function</span> GetIP<span style="color: #66cc66;">&#40;</span>sNick<span style="color: #66cc66;">&#41;</span>
    res, ip <span style="color: #66cc66;">=</span> VH:GetUserIP<span style="color: #66cc66;">&#40;</span>sNick<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">return</span> ip
<span style="color: #b1b100;">end</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://case.net.ru/2009/02/06/verlihub-lua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
