string.starts?

I’ve tried string.match, but to no avail

Essentially I want to return the string searched for if the string that starts with it matches

so if I searched

a1

and I was searching through a12 , a1 would return a12 since it’d match

I tried


local var = "sillystring"

local pattern = some pattern

string.match( var, pattern ) 

I know string.match won’t work even if I had a proper pattern since I’d have to customize my search requests with that search I defined, ie a12

anyway, does such functionality exist?

[lua]
local string=“sillystring”
local pattern=“silly”

print(string.match(string,pattern…"%w+"))
[/lua]


function string.start(str, start) return string.sub(str, 1, string.len(start)) == start end