Skip to content

Instantly share code, notes, and snippets.

@mascarenhas
Created October 22, 2009 21:16
Show Gist options
  • Save mascarenhas/216341 to your computer and use it in GitHub Desktop.
Save mascarenhas/216341 to your computer and use it in GitHub Desktop.
template = "$do_cards[[$rank of $suit, ]]"
view = {
{ rank = "Ace", suit = "Spades" },
{ rank = "10", suit = "Hearts" },
}
result = cosmo.fill(template, {
do_cards = function()
for i,v in ipairs(view) do
cosmo.yield(v)
end
end
})
print(result) -- Ace of Spades, 10 of Hearts,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment