lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I would like to fill a template in which the insertion point is directly followed by an underscore; is there a way to convince cosmo to do it?

local template = "function $name_new"
local fields = { name = "foo" }
print(cosmo.fill(template, fields))

(wanted "function foo_new", got "function $name_new")

I understand that cosmo cannot distinguish the possibility of a key 'name_new' in the fields table, but I thought perhaps there was a way to explicitly delimit the key in the template itself. E.g.:

local template = "function $[name]_new"

Or something like that. If not, then maybe this could be a feature suggestion?