summaryrefslogtreecommitdiff
path: root/test/split.lua
diff options
context:
space:
mode:
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")