Did string.gfind() change between 5.1 and 5.2?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Did string.gfind() change between 5.1 and 5.2?

Steve Litt
Hi all,

I couldn't find an answer with a Google search, so I'm asking here.
Some code that worked in Lua 5.1 croaked in the following way in 5.2:

==========================================
/usr/bin/lua: ./umenu.lua:128: attempt to call field 'gfind' (a nil
value)
stack traceback:
        ./umenu.lua:128: in function 'prompted_argument_substitution'
        ./umenu.lua:182: in function 'write_script'
        ./umenu.lua:433: in function 'mainloop'
        ./umenu.lua:446: in main chunk
        [C]: in ?
slitt@mylap4:~/ulua/program>
==========================================

Here's the mentioned code:

==========================================

   125 function self.prompted_argument_substitution(str)
   126 local words = {}
   127 local w
   128 for w in string.gfind(str, "%%.%%.-%%%%") do
   129 table.insert(words, w)
   130 end
==========================================

Has something about string.find() changed in 5.2?

Thanks

SteveT

Reply | Threaded
Open this post in threaded view
|

Re: Did string.gfind() change between 5.1 and 5.2?

Luiz Henrique de Figueiredo
> Some code that worked in Lua 5.1 croaked in the following way in 5.2:

string.gfind was part of 5.0, deprecated in 5.1, and removed in 5.2.
More precisely, string.gfind was renamed to string.gmatch in 5.1 and
that's what it is in 5.2.

Reply | Threaded
Open this post in threaded view
|

Re: Did string.gfind() change between 5.1 and 5.2? <SOLVED>

Steve Litt
On Wed, 3 Apr 2013 22:14:59 -0300
Luiz Henrique de Figueiredo <[hidden email]> wrote:

> > Some code that worked in Lua 5.1 croaked in the following way in
> > 5.2:
>
> string.gfind was part of 5.0, deprecated in 5.1, and removed in 5.2.
> More precisely, string.gfind was renamed to string.gmatch in 5.1 and
> that's what it is in 5.2.
>

Thanks Luiz,

Confirmed, changing it to gmatch() works on 5.2. Thanks also to
<fogfx1> on the Lua IRC, who told me the same thing.

SteveT