Page 2 of 2

Re: Targeting alias

Posted: Sat Jan 02, 2010 5:05 pm
by Iocun
Have you tried deleting the alias and creating it again? When I create an alias with the identical pattern "^z (.*)$", it works perfectly for me.

Re: Targeting alias

Posted: Sat Jan 02, 2010 5:18 pm
by Vadi
Heiko wrote:^z (.*)$" *would* work nicely, *IF* he used that, but uses "^z (.*)$\s" which will never match in Mudlet.
That's why I told him to use the debug console in the future 8-)
His xml has this though:
<Alias isActive="yes" isFolder="no">
<name>Target Get</name>
<script>burger = matches[2]</script>
<command></command>
<regex>^z (.*)$
</regex>
</Alias>
Maybe \n got in there by accident and wasn't rendered?

Re: Targeting alias

Posted: Sat Jan 02, 2010 5:35 pm
by Excelsi
Well it worked of course, so thanks, both.

Oh yeah, the variable was only changed to "burger" so I could check "target" wasn't some reserved keyword. Looks a bit weird.

Re: Targeting alias

Posted: Sat Jan 02, 2010 6:22 pm
by Excelsi
Ergh. It's back. I don't understand the Lua errors, but it feels like bugs to me.

Code: Select all

rget Get(^z (.*)) matched.
Alias: capture group #1 = <z blah>
Alias: capture group #2 = <blah>
LUA: ERROR running script Target Get (Alias1) ERROR:Lua error:[string "function Alias1()..."]:2: 
attempt to index global 'match' (a nil value)
Alias name=Bash(^x$) matched.
Alias: capture group #1 = <x>
LUA: ERROR running script Bash (Alias2) ERROR:Lua error:[string "function Alias2()..."]:2: attempt to concatenate global 'target' (a nil value)

Re: Targeting alias

Posted: Sat Jan 02, 2010 6:39 pm
by Vadi
Feels like typos to me. "match" as it says doesn't exist. Maybe you want matches?

Re: Targeting alias

Posted: Sat Jan 02, 2010 6:45 pm
by Excelsi
Oh dear. :|

Re: Targeting alias

Posted: Sat Jan 02, 2010 6:50 pm
by Vadi
So you understand it in the future:

Code: Select all

get Get(^z (.*)) matched.
Alias: capture group #1 = <z blah>
Alias: capture group #2 = <blah>
LUA: ERROR running script Target Get (Alias1) ERROR:Lua error:[string "function Alias1()..."]:2: 
attempt to index global 'match' (a nil value)
Alias name=Bash(^x$) matched.
Alias: capture group #1 = <x>
LUA: ERROR running script Bash (Alias2) ERROR:Lua error:[string "function Alias2()..."]:2: attempt to concatenate global 'target' (a nil value)

Code: Select all

get Get(^z (.*)) matched.
Alias: capture group #1 = <z blah>
Alias: capture group #2 = <blah>
LUA: ERROR running script Target Get (Alias1) ERROR:Lua error:[string "function Alias1()..."]:2: 
attempt to index global 'match' (a nil value)
That's all one alias matching. get Get(^z (.*)) matched. means alias named Get with the pattern ^z (.*) matched.

Code: Select all

Alias: capture group #1 = <z blah>
Alias: capture group #2 = <blah>
Just information to help you - it means matches[1] contains z blah and matches[2] contains blah.

Code: Select all

LUA: ERROR running script Target Get (Alias1) ERROR:Lua error:[string "function Alias1()..."]:2: 
attempt to index global 'match' (a nil value
That means Lua was upset about your script running.

Code: Select all

attempt to index global 'match' (a nil value
Is the actual Lua error. "attempt to index" basically means "get". a nil value, well nil in Lua means it does not exist. So match having a nil value = Lua couldn't find such a variable!