Added dict to core lib.

This commit is contained in:
Bruce Hill 2017-09-14 04:16:22 -07:00
parent 39a92bd1ab
commit 7c02fe0564

View File

@ -279,4 +279,15 @@ macro block "test %code yields %expected":
error!
return ""
rule "dict %items":
let "dict" = []
for "pair" in %items:
lua block "vars.dict[vars.pair[1]] = vars.pair[2]"
return %dict
rule "%dict -> %key":
lua expr "vars.dict[vars.key]"
rule "%dict -> %key = %value":
lua block "vars.dict[vars.key] = vars.value"