diff options
author | Natanael Copa <natanael.copa@gmail.com> | 2007-07-27 12:53:38 +0000 |
---|---|---|
committer | Natanael Copa <natanael.copa@gmail.com> | 2007-07-27 12:53:38 +0000 |
commit | dc53423183a0c459284ebd139022b707f01af006 (patch) | |
tree | 8a67a2904ec991028bddd429d57eec114b05baab /lib/join.lua | |
parent | 275c80281ba2e84b8d810bdb1c2b7f8c9a4333d9 (diff) | |
download | acf-core-dc53423183a0c459284ebd139022b707f01af006.tar.bz2 acf-core-dc53423183a0c459284ebd139022b707f01af006.tar.xz |
moved core files to new dir structurev2.0_alpha1
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@219 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/join.lua')
-rw-r--r-- | lib/join.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/join.lua b/lib/join.lua new file mode 100644 index 0000000..e3621de --- /dev/null +++ b/lib/join.lua @@ -0,0 +1,25 @@ +--[[ + module for joining an array to a string +]]-- + +module (..., package.seeall) + + +-- This code comes from http://lua-users.org/wiki/SplitJoin +-- +-- Concat the contents of the parameter list, +-- -- separated by the string delimiter (just like in perl) +-- -- example: strjoin(", ", {"Anna", "Bob", "Charlie", "Dolores"}) +return function (delimiter, list) + local len = getn(list) + if len == 0 then + return "" + end + local string = list[1] + for i = 2, len do + string = string .. delimiter .. list[i] + end + return string +end + + |