Skip to content

Instantly share code, notes, and snippets.

View Vurv78's full-sized avatar
😶

Vurv Vurv78

😶
View GitHub Profile
@Vurv78
Vurv78 / StrMatch.lua
Last active January 30, 2021 01:02
Lua string match function
-- Program: Lua String Match Func
-- Purpose: To help in tokenizers and stuff. This is a pretty tiny function that allows you to match for custom strings (of course it also has perfect escape-character support.)
-- Returns number start_pos, number end_pos, string match
-- Vurv Update 0.2.0 12/25/2020
-- Make sure quote and escape don't interfere with lua patterns.
local function match_str(self,quote,escape,pos)
local matched = false
local exp = string.format( "^[%s](.-)([%s]-)%s",quote,escape,quote )
local matches = {}