/strung.lua

Lua string patterns rewritten for LuaJIT (without the FFI library)

Primary LanguageLuaMIT LicenseMIT

Vurv78/strung.lua

Fork of strung.lua in hopes of removing uses of the ffi library for use in restricted environments (such as Garry's Mod)

Note performance is likely worse than original patterns since this does not make use of the ffi library. This was made to prevent deadlocks with bad lua patterns by doing cpu limiting in lua.

Usage

You can include/require the strung.lua file alone.

local strung = require "strung"

strung.find("foobar", "b(%l*)") --> 4, 6, "ar"

Alternatively, you can .install() the library, and have it replace the original functions completely.

strung.install()

print(string.find == strung.find) --> true

S = "foo"

S:match "[^f]*" --> "oo", using `strung.match` rather than `string.match`