Is there a stringtext module on luarocks?

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

Is there a stringtext module on luarocks?

Dirk Laurie-2
Before rolling my own: is there a module on luarocks that makes a string
look like a text file?

I.e. supporting methods like "lines", "read" and "seek"?

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Vadim A. Misbakh-Soloviov
> Before rolling my own: is there a module on luarocks that makes a string
> look like a text file?
>
> I.e. supporting methods like "lines", "read" and "seek"?

Should we make luarocks be as npm?

I.e. adding every thtrr-line snippets there as a module?

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Daurnimator
In reply to this post by Dirk Laurie-2
On 17 February 2017 at 17:14, Dirk Laurie <[hidden email]> wrote:
> Before rolling my own: is there a module on luarocks that makes a string
> look like a text file?
>
> I.e. supporting methods like "lines", "read" and "seek"?

Use io.tmpfile. i.e.

local file = io.tmpfile()
assert(file:write("my string"))
assert(file:seek("set"))

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Coda Highland
In reply to this post by Vadim A. Misbakh-Soloviov
On Thu, Feb 16, 2017 at 10:25 PM, Vadim A. Misbakh-Soloviov
<[hidden email]> wrote:
>> Before rolling my own: is there a module on luarocks that makes a string
>> look like a text file?
>>
>> I.e. supporting methods like "lines", "read" and "seek"?
>
> Should we make luarocks be as npm?
>
> I.e. adding every thtrr-line snippets there as a module?
>

This would quite a bit more than 30 lines of code unless someone's
very clever. I think this is a very reasonable question to ask.

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

steve donovan
In reply to this post by Dirk Laurie-2
On Fri, Feb 17, 2017 at 8:14 AM, Dirk Laurie <[hidden email]> wrote:
> I.e. supporting methods like "lines", "read" and "seek"?

There you go: https://luarocks.org/modules/steved/stringio

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Choonster TheMage
In reply to this post by Dirk Laurie-2
On 17 February 2017 at 17:14, Dirk Laurie <[hidden email]> wrote:
> Before rolling my own: is there a module on luarocks that makes a string
> look like a text file?
>
> I.e. supporting methods like "lines", "read" and "seek"?
>

Penlight's stringio module[1] does this.

Regards,
Choonster

[1] http://stevedonovan.github.io/Penlight/api/libraries/pl.stringio.html

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Dirk Laurie-2
In reply to this post by steve donovan
2017-02-17 8:30 GMT+02:00 steve donovan <[hidden email]>:
> On Fri, Feb 17, 2017 at 8:14 AM, Dirk Laurie <[hidden email]> wrote:
>> I.e. supporting methods like "lines", "read" and "seek"?
>
> There you go: https://luarocks.org/modules/steved/stringio

Thanks. Just what I need.

Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

steve donovan
In reply to this post by Choonster TheMage
On Fri, Feb 17, 2017 at 8:36 AM, Choonster TheMage
<[hidden email]> wrote:
> Penlight's stringio module[1] does this.

I went through a phase of releasing little bits of Penlight as
separate rocks, maybe I'll continue.

Reply | Threaded
Open this post in threaded view
|

Re: Is there a stringtext module on luarocks?

Sean Conner
In reply to this post by Vadim A. Misbakh-Soloviov
It was thus said that the Great Vadim A. Misbakh-Soloviov once stated:
> > Before rolling my own: is there a module on luarocks that makes a string
> > look like a text file?
> >
> > I.e. supporting methods like "lines", "read" and "seek"?
>
> Should we make luarocks be as npm?
>
> I.e. adding every thtrr-line snippets there as a module?

  I have a few modules that are just a single function, such as Soundex [1],
the Y-combinator [2], Roman numberal conversion [3] and some other ones [4].
I've been hesitant to publish them just because of npm (well, rather the
whole npm leftpad fiasco).

  -spc

[1] https://en.wikipedia.org/wiki/Soundex

[2] https://en.wikipedia.org/wiki/Fixed-point_combinator#Fixed_point_combinators_in_lambda_calculus

[3] From a number (integer) to Roman numeral (string), or from Roman
        numeral (string) to a number.

[4] A "safestring" conversion routine, the core RFC BNF rules in LPeg, a
        function to do a hexdump, stuff like that ...