0
kobenz
254d

maybe I'm a simpleton, but I've just found out about LuaJIT's string.buffer and I'm procrastinating the heck out of it right now 🤤🤤🤤

Comments
  • 0
  • 1
    @Ranchonyx zero-copy, ultrafast strings! I'm going nuts here, it even comes with a fast as fuck serializer for ANY Lua value, decoding AND encoding.

    FUCK, the possibilities are jaw dropping: Immutability! Pattern matching! Data storage! Not that that shit wasn't already possible, but now I don't need a fuck ton of logic for it.

    -----

    *Lua strings suck, it's like teenage pregnancy, any "just the tip" and it's "boom! new string!", even if you've just added a single character, the whole thing's considered new shit, stored for "reuse".
  • 0
    @kobenz I don't know what you are talking about tbh. Most string implementations do spawn new strings if you append something.

    In C# there is the String Builder Class to prevent that if you want to concat many strings.
  • 0
    @KDSBest oh, no, if only it was just that. all strings in Lua are internalized. Lua will keep a single copy of EVERY unique string and it will check every string in your code so it can make sure it has all of them, it doesn't matter if you'll never use it again, Lua will hoard it
  • 0
    there's no "oh but this one's made up of those other two". Nop, to Lua, the third one will be a whole different string
  • 0
    As it just so happens with every language that considers strings as immutable, C does it, C# does it, Java does it...
  • 0
    @kobenz maybe don't use lua :D.
    It's a script engine for small scripts IIRC
  • 0
    @KDSBest if I had that option I wouldn't be using it lol

    @CoreFusionX nope, to be clear, you can't index a Lua string

    ---

    shit, at least it's not indentation scoped
Add Comment