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