lua-l archive
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
] [
Date Index
] [
Thread Index
]
Subject
:
Re: Use-cases for string.gsub(str, "().", "%1")
From
: Fidelis Assis <fidelis.assis@
...
>
Date
: Thu, 20 Aug 2015 15:54:31 -0300
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
Follow-Ups
:
Re: Use-cases for string.gsub(str, "().", "%1")
,
Soni L.
References
:
Use-cases for string.gsub(str, "().", "%1")
,
Soni L.
Re: Use-cases for string.gsub(str, "().", "%1")
,
Matthew Wild
Re: Use-cases for string.gsub(str, "().", "%1")
,
Soni L.
Prev by Date:
Re: require behavior in modules
Next by Date:
Re: Use-cases for string.gsub(str, "().", "%1")
Previous by thread:
Re: Use-cases for string.gsub(str, "().", "%1")
Next by thread:
Re: Use-cases for string.gsub(str, "().", "%1")
Index(es):
Date
Thread