summaryrefslogtreecommitdiff
path: root/test/split.lua
diff options
context:
space:
mode:
authorLua Team <team@lua.org>1994-07-08 12:00:00 +0000
committerrepogen <>1994-07-08 12:00:00 +0000
commit944fc7d7d95575f2b8023c1f3d4ac19e1369fc76 (patch)
treeeabf0822f2058229cd0d49c7928683b8cf0ed88e /test/split.lua
parent8b5979a7e8b9732aa2883d2384f853d87b594770 (diff)
downloadlua-github-1.1.tar.gz
Lua 1.11.1
Diffstat (limited to 'test/split.lua')
-rw-r--r--test/split.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/split.lua b/test/split.lua
new file mode 100644
index 00000000..0f64c508
--- /dev/null
+++ b/test/split.lua
@@ -0,0 +1,18 @@
+function split (s)
+ local n = 1
+ local f = strfind(s,"/")
+ while f do
+ n = n+f
+ f = strfind(strsub(s,n),"/")
+ end
+ return strsub(s,1,n-1), strsub(s,n)
+end
+
+
+function test(s)
+ local path, filename = split(s)
+ print(s .. "=[".. path.."]+["..filename.."]")
+end
+
+test("a:/lua/obj/lua.c")
+test("lua.lib")