Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:SplitStringToTable

From EmissaryFGC
Revision as of 20:22, 12 May 2024 by dustloop>TarkusLee (Created page with "local p = {} --p stands for package --- Split string by delimiter and return the table of string parts --- --- @param str string String to split --- @param delimiter string Delimiter used to split the string, default to %s --- @return table function p.splitStringIntoTable( str, delimiter ) if delimiter == nil then delimiter = "%s" end local t = {} for s in string.gmatch( str, '[^' .. delimiter .. ']+' ) do...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:SplitStringToTable/doc

local p = {} --p stands for package

--- Split string by delimiter and return the table of string parts
---
--- @param str string String to split
--- @param delimiter string Delimiter used to split the string, default to %s
--- @return table
function p.splitStringIntoTable( str, delimiter )
        if delimiter == nil then
                delimiter = "%s"
        end
        local t = {}
        for s in string.gmatch( str, '[^' .. delimiter .. ']+' ) do
                table.insert( t, s )
        end
        return t
end

return p
MediaWiki Appliance - Powered by TurnKey Linux