User Tools

Site Tools


function_find
find.lua
-- Copyright (C) 2018 CurlyMo & Niek
 
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
local M = {}
 
function M.run(a, b, c)
	if a == nil or b == nil or c ~= nil then
		error("FIND requires two arguments")
		return nil
	end
	local n = -1
	local s = nil
	local e = 0
	repeat 
		s, e = string.find(a, b, e + 1)
		n = n + 1
	until s == nil
	return n
end
 
function M.info()
	return {
		name = "FIND",
		version = "1.0",
		reqversion = "8.1.1",
		reqcommit = "0"
	}
end
 
return M
function_find.txt · Last modified: 2018/08/07 11:40 by Niek