|
Turncoat Newbie
Joined: 19 Sep 2011 Posts: 5
|
Posted: Sun Dec 02, 2012 7:12 pm
Lua table, and cmud params |
Hello Everyone!
I have a trigger setup that finds mobs in a room, pretty easy:
Code: |
^~[%w~] ~[*~] (*).$
|
That is the trigger part, and using zscript and doing the following, WILL work.
Going to lua, and doing the following:
Code: |
tt = { [ "The large form of Muraka basks in the light." ] = "goblin"}
print(tt["The large form of Muraka basks in the light."])
print(tt[zs.param(1)])
|
Does not work with the last statement. I've been trying various ways, but to no avail. Accessing the variable in the second statement works fine and it prints "goblin".
I am trying to use the param as a dictionary key in lua, and am not sure how to do it. Any assistance would be greatly appreciated!
(using cmud 3.34) |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Tue Dec 04, 2012 2:01 am |
I am wondering what else you may be doing wrong because the above test worked for me as expected.
If Lua (via CMUD) is not throwing an error then I would examine exactly what the trigger is capturing. You may have to trim whatever you get since ["mob"], ["mob "] or [" mob"] are distinct keys. |
|
_________________ Sic itur ad astra. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Dec 04, 2012 4:36 am |
Anaristos has a point there. Sometimes, a MUD doesn't end something where it should end, and you wind up capturing
Code: |
This sentence ends over there -> " |
instead of
Code: |
"This sentence ends right here" |
You may look into using %trim or zs.func.trim(zs.param(1)) instead. |
|
|
|
|
|