I am trying to find out how templates (implemented in string.gmatch , etc.) work in Lua 5.3, from the reference guide.
(Thanks to @greatwolf for correcting my interpretation of the picture element using *.)
What I'm trying to do is match '(%(.*%))*' (Substrings enclosed ( and ) , for example, '(grouped (etc))' ) so that it is logged
(grouped (etc.))
(Etc.)
or
grouped (etc.)
etc.
But he does nothing 😐 ( online compiler ).
local test = '(grouped (etc))' for sub in test:gmatch '(%(.*%))*' do print(sub) end
Hydro source share