Skip to content

Instantly share code, notes, and snippets.

@dextercd
Created August 20, 2024 19:52
Show Gist options
  • Save dextercd/c0bb43e0fa900848d585c780097acd95 to your computer and use it in GitHub Desktop.
Save dextercd/c0bb43e0fa900848d585c780097acd95 to your computer and use it in GitHub Desktop.
local stringify = dofile_once("mods/component-explorer/deps/datadumper.lua")
if not pat_init then
pat_init = true
pattern = ""
sample = ""
end
if not imgui.Begin("Pattern") then return end
_, pattern = imgui.InputText("Pattern", pattern)
_, sample = imgui.InputTextMultiline("##sample", sample, -1, 7 * imgui.GetTextLineHeight())
local result = {pcall(string.match, sample, pattern)}
if not result[1] then
imgui.Text("Error: " .. result[2])
else
imgui.Text("Result (" .. #result - 1 .. ")")
for i=2,#result do
imgui.Bullet() imgui.Text(result[i])
end
end
imgui.End()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment