lua-users home
lua-l archive

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




On 20/08/15 03:54 PM, Fidelis Assis wrote:
Can also be used for expansion of positional notation

s = '1010'
print((string.gsub(s, "()(.)", function (p, d) return ' + ' .. d .. '*2^' .. #s-p end))

+ 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0

and base conversion.

-- Fidelis

Not the same as using it in the replacement string.

--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.