Targeting alias

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Targeting alias

Post 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.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Targeting alias

Post 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?

Excelsi
Posts: 10
Joined: Thu Dec 24, 2009 3:09 pm

Re: Targeting alias

Post 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.

Excelsi
Posts: 10
Joined: Thu Dec 24, 2009 3:09 pm

Re: Targeting alias

Post 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)

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Targeting alias

Post by Vadi »

Feels like typos to me. "match" as it says doesn't exist. Maybe you want matches?

Excelsi
Posts: 10
Joined: Thu Dec 24, 2009 3:09 pm

Re: Targeting alias

Post by Excelsi »

Oh dear. :|

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Targeting alias

Post 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!

Post Reply