require "list" local s = slist.of("A", "B") local ixs = s:find("A") -- always returns an array of indices even if we only want the first if #ixs > 0 then s:insert(ixs[1] + 1, "C") print(s) end