I'm getting mixed signals on how Lua variables within triggers work... In my plugin, I define a table in the code section. I also have a trigger that checks the size of this table (it's a vector). And then I have another trigger that calls a function to add another element to the table.
This all worked fine until I got rid of the function and moved it into the trigger body itself. For some strange reason, it's acting like the other table never even existed. I didn't change the code at all except for moving it from the function to the trigger body. And what makes it more disconcerting than usual is that the first trigger, the one that checks how many elements are in the table, works fine, and I haven't changed it at all.
Any idea what's going on? I've been trying to clean up the plugin a bit, and I don't like straggling functions that are only used in one place...
MUSHclient version 4.35, by the way.
This all worked fine until I got rid of the function and moved it into the trigger body itself. For some strange reason, it's acting like the other table never even existed. I didn't change the code at all except for moving it from the function to the trigger body. And what makes it more disconcerting than usual is that the first trigger, the one that checks how many elements are in the table, works fine, and I haven't changed it at all.
<!-- Parses PLANTS for the list of herbs present -->
<trigger enabled="n" group="harvest_scan2" keep_evaluating="y" omit_from_output="y"
regexp="y" send_to="14" sequence="100"
match="^[A-Za-z' ]+ \(([a-z' ]+)\)\s+\w+$" >
<send>
-- This is the line that -was- in a function.
table.insert(toharvest, (herbs[herb] or herb))
</send>
</trigger>
<!-- Ends the parsing of PLANTS and acts on the list of plants -->
<trigger enabled="n" group="harvest_scan2" keep_evaluating="y" omit_from_output="y"
regexp="y" send_to="14" sequence="100"
match="^(?:\d+h, )?(?:\d+m,? )?(?:\d+e,? )?(?:\d+w,? )?c?e?x?k?d?b?@? ?(?:Vote)?- ?$" >
<send>
EnableGroup("harvest_scan2", false)
if (#toharvest > 0) then
EnableGroup("harvest_act", true)
DoHarvest()
else
Note("There aren't any plants to harvest!")
running = false
Send()
end
</send>
</trigger>
Any idea what's going on? I've been trying to clean up the plugin a bit, and I don't like straggling functions that are only used in one place...
MUSHclient version 4.35, by the way.