summaryrefslogtreecommitdiff
path: root/test/split.lua
blob: 0f64c508378da0be18acc238b20f5cea9c36b262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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")