The eccoMAGIC Forums
http://forums.eccoMAGIC.com/forum/YaBB.pl
the SLANG EXTENSION and Guest Programming >> Slangmgh: Questions, Suggestions, Requests >> Setup of Lua to work with Eccoext
http://forums.eccoMAGIC.com/forum/YaBB.pl?num=1212899353

Message started by tachyonfist on 06/07/08 at 23:29:13

Title: Setup of Lua to work with Eccoext
Post by tachyonfist on 06/07/08 at 23:29:13

I am interested in using Lua with Eccoext.  I have download Lua from www.lua.org.  Since there is no installer I was interested in what/where I need to place files to have Lua scripting in Eccoext work.




Title: Re: Setup of Lua to work with Eccoext
Post by Admin on 06/08/08 at 13:36:06



Short answer: NOTHING!



The LUA language is *built in* to the slang extension.


Only if you wish to use perl or python,  need you worry about external program installation.


JavaScript and VBScript should also work 'right out of the box'  on most systems.




Title: Re: Setup of Lua to work with Eccoext
Post by tachyonfist on 06/09/08 at 09:39:41

Thanks for the clarification.  Still glad I downloaded as I will use this to do other types of Lua testing.

tachyonfist

Title: Re: Setup of Lua to work with Eccoext
Post by randfb on 10/02/08 at 12:45:35

How can I use an external Python script with EccoExt ?

Rand

Title: Re: Setup of Lua to work with Eccoext
Post by Admin on 10/02/08 at 18:17:35



Yes you can call external scripts from a LUA rule or function.  (there are threads on that here, if memory servers).

You can have a python script WITHIN a rule.


Title: Re: Setup of Lua to work with Eccoext
Post by randfb on 04/13/10 at 12:40:53

Could you give me an example of the use of python within a rule ?

Rand

Title: Re: Setup of Lua to work with Eccoext
Post by Admin on 04/13/10 at 13:13:06


randfb wrote:
Could you give me an example of the use of python within a rule ?

Rand



Have you tried any script within a rule ?


eg.,  have you tried simple LUA to get down basic syntax & how to for  simple script ?



Title: Re: Setup of Lua to work with Eccoext
Post by randfb on 04/13/10 at 15:01:34

I just tried the example at
http://eccoextdoc.wikispaces.com/Sample+Program+2

and I got a message
"
Error 31 launching "C:\Program Files\ECCO\luacmd.lua"
"

Title: Re: Setup of Lua to work with Eccoext
Post by Admin on 04/13/10 at 19:03:14

perhaps this is helpful:

[html]


<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; just put any script in luacmd.lua, it will be loaded anytime when you</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; execute lua rule.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; maybe the file name should be eccoext.lua, just like any other</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; supportted script type :-).</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">I put this simple script in luacmd.lua:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">(A message pops up if new item with text &quot;New&quot; is added)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">It works fine when added to any Ecco folder, but not when added to</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">luacmd.lua. What am I doing wrong?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">luacmd.lua holds functions (you can call from rules or tools), not rules.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; just put any script in luacmd.lua, it will be loaded anytime when you</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; execute lua rule.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; maybe the file name should be eccoext.lua, just like any other</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; supportted script type :-).</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; I put this simple script in luacmd.lua:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; (A message pops up if new item with text &quot;New&quot; is added)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; It works fine when added to any Ecco folder, but not when added to</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; luacmd.lua. What am I doing wrong?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, &quot;yoursowelcomethanks&quot;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&lt;perlloaderplease@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; if you define a LUA function in the external file,</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; you can 'execute' that just like any LUA command AS YOUR LUA RULE.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">How woudl I call such a function from the rule?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Something like</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:LUAScript:myfunction() ?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; How woudl I call such a function from the rule?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; Something like</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:LUAScript:myfunction() ?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L: myfunction([optional vars])</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, &quot;yoursowelcomethanks&quot;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&lt;perlloaderplease@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; --- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; How woudl I call such a function from the rule?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; Something like</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; ++:L:LUAScript:myfunction() ?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L: myfunction([optional vars])</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">I still can not get my rules in luacmd.lua to work.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Per YSWT's post above, I placed the LUA rule as a function in luacmd.lua:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">function newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">I next added the rule in an Ecco folder:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:LUAScript:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">However, the rule is not executing! What am I doing wrong?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">p.s. As explained previously, it works fine when I place the rule</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">directly in a folder:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Slang has added so much, it's easy to need a few send looks to get it</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">all down pat.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">LUAScript:newpopup() is format style of LAUNCH TOOL syntax.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">functions BECOME part of the LUA langauge.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">so if you have a function newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&quot;newpopup()&quot; becomes a LUA command, just like x = x + 1</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">so,</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">your rule is just</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; --- In ecco_pro@yahoogroups.com, &quot;yoursowelcomethanks&quot;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &lt;perlloaderplease@&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; --- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt; How woudl I call such a function from the rule?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt; Something like</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt; ++:L:LUAScript:myfunction() ?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; ++:L: myfunction([optional vars])</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; I still can not get my rules in luacmd.lua to work.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; Per YSWT's post above, I placed the LUA rule as a function in</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">luacmd.lua:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; function newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; I next added the rule in an Ecco folder:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:LUAScript:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; However, the rule is not executing! What am I doing wrong?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; p.s. As explained previously, it works fine when I place the rule</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; directly in a folder:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; B=get_item_text(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; if B==&quot;New&quot; then msgbox(&quot;New Added&quot;) end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, &quot;yoursowelcomethanks&quot;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&lt;perlloaderplease@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; Slang has added so much, it's easy to need a few send looks to get it</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; all down pat.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; LUAScript:newpopup() is format style of LAUNCH TOOL syntax.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; functions BECOME part of the LUA langauge.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; so if you have a function newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &quot;newpopup()&quot; becomes a LUA command, just like x = x + 1</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; so,</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; your rule is just</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Sorry there was a typo in my post. Indeed my rule was:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">However, it still doesn't work though, because the item_id is not</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">automatically passed to the function. To get it to work, I need to</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">pass the item ID:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">++:L:newpopup(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN"><span class="f5" style="font-size:12pt;color:#0000FF;">Re: ADVANCED TOPIC: LUA Rules or LUA Script?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">Re: ADVANCED TOPIC: LUA Rules or LUA Script? </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">--- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; --- In ecco_pro@yahoogroups.com, &quot;yoursowelcomethanks&quot;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &lt;perlloaderplease@&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; Slang has added so much, it's easy to need a few send looks to</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">get it</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; all down pat.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; LUAScript:newpopup() is format style of LAUNCH TOOL syntax.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; functions BECOME part of the LUA langauge.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; so if you have a function newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; &quot;newpopup()&quot; becomes a LUA command, just like x = x + 1</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; so,</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; your rule is just</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt; ++:L:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; &gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; Sorry there was a typo in my post. Indeed my rule was:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:newpopup()</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; However, it still doesn't work though, because the item_id is not</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; automatically passed to the function. To get it to work, I need to</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; pass the item ID:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt; ++:L:newpopup(item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">you can add a function newpopup with one parameter in luacmd.lua,</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;">then use ++:L:newpopup(item_id) in the folder rule.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f6" style="font-size:10pt;font-weight:bold;color:#000080;"></span></p>
[/html]

Title: Re: Setup of Lua to work with Eccoext
Post by Admin on 04/13/10 at 19:21:11


Also this example may be helpful:

[html]

<p class="EN"><span class="f5" style="font-size:8pt;color:#0000FF;">Re: EccoExt; LUA Rules; Solution to A=B+2 &amp; B=A-2</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">Re: EccoExt; LUA Rules; Solution to A=B+2 &amp; B=A-2 </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"> </span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">It was a bit tricky, but I am giving a solution below in case someone</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">else needs it. The approach can be used to set up a rule that</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">calculates values in one folder based on values in another OR vice versa!</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">For examples, we may have the simple relation:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">Cost=Rate*Hrs where Cost is in one folder and Hrs is in another.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">If we change Cost, we want EccoExt to calculate the resulting Hrs</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">(=Cost/Rate)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">If we change Hrs, we want EccoExt to calculate the resulting</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">Cost(=Rate*Hrs)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">In my own example I had the relation</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">B=A+2 (or A=B-2)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">I setup 4 number folders:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">A, B, PrA, PrB</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">PrA &amp; PrB are dummy folders that holds the previous values (only used</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">for the LUA Rule to work). The LUA script is then placed in any folder</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">(e.g. &quot;LUA_Rules&quot;):</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">++:L:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vA=get_folder_value(&quot;A&quot;,item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vB=get_folder_value(&quot;B&quot;,item_id)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vPrA=get_folder_value(&quot;PrA&quot;,item_id) -- Get Previous Value</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vPrB=get_folder_value(&quot;PrB&quot;,item_id) -- Get Previous Value</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">if vPrA~=vA then -- A Changed =&gt; Calulate B &amp; set new PrA, PrB</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vB=vA+2</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;B&quot;,item_id,vB)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;PrB&quot;,item_id,vB)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;PrA&quot;,item_id,vA)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">elseif vPrB~=vB then -- B Changed =&gt; Calulate A set new PrA, PrB</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">vA=vB-2</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;A&quot;,item_id,vA)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;PrA&quot;,item_id,vA)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">set_folder_value(&quot;PrB&quot;,item_id,vB)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">-- else msgbox(&quot;No folder Changed&quot;)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">end</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">The message box is of course optional (and commented out with -- above)</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">p.s. YSWT, I guess I will try to post in the EM forum as well. I agree</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">that it would be easier to find bugs, scripts etc there rather than</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">have to search here. However, I suspect that many users of this forum</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">may not bother reading the EM forum (in particular if they have an</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">E-mail subscription to this forum....).</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">--- In ecco_pro@yahoogroups.com, rbrandes1 &lt;no_reply@...&gt; wrote:</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; I am still trying to figure out a way to calculate two number folders.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; If value in A changes, I would like to calculate value in B and vice</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; versa.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; e.g.</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; B=A+2</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; A=B-2</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; Is there some LUA way that I can tell which folder (A or B), I changed</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt; the number in?</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;">&gt;</span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>
<p class="EN" style="margin-left:0.75cm;"><span class="f8" style="font-size:10pt;color:#000080;"></span></p>

[/html]

from:
Ecco_Pro post 3754      rbrandes1      EccoExt; LUA Rules                  

                                         

The eccoMAGIC Forums » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.