It's not Lua, it's MikroTik's custom thing (they briefly had Lua in some beta version, but it didn't make it to final). It wouldn't be that bad, it's slightly unintuitive, but it would be possible to get used to it. Main problem is that it doesn't have any useful feedback, typo in code means silent death, without any indication what's wrong. And then there's things like this. I usually have no problem doing small things even in programming languages I don't know, but not with RouterOS scripting, I get stuck all the time.
If I try simplified script:
:local list "test1";
:local ip "1.0.0.0";
:log info $list
:log info $ip
/log info [/ip firewall address-list find list="test1" address="1.0.0.0"];
/log info [/ip firewall address-list find list="test1" address=$ip];
/log info [/ip firewall address-list find list=$list address="1.0.0.0"];
/log info [/ip firewall address-list find list=$list address=$ip];
then I get:
18:04:43 script,info test1
18:04:43 script,info 1.0.0.0
18:04:43 script,info *5
18:04:43 script,info *5
18:04:43 script,info *5;*7;*8;*b
18:04:43 script,info *5;*7;*8;*b
So variables have expected values and *5 is correct id for item I'm searching for. It means that second command with address=$ip works fine too. But next two find 1.0.0.0 in all address lists, so there's some problem with list=$list. But what could it be?