Imported from ../lua-1.1.tar.gz.
[lua.git] / test / split.lua
blob0f64c508378da0be18acc238b20f5cea9c36b262
1 function split (s)
2 local n = 1
3 local f = strfind(s,"/")
4 while f do
5 n = n+f
6 f = strfind(strsub(s,n),"/")
7 end
8 return strsub(s,1,n-1), strsub(s,n)
9 end
12 function test(s)
13 local path, filename = split(s)
14 print(s .. "=[".. path.."]+["..filename.."]")
15 end
17 test("a:/lua/obj/lua.c")
18 test("lua.lib")