repo.or.cz
/
lua.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Imported from ../lua-1.1.tar.gz.
[lua.git]
/
test
/
split.lua
blob
0f64c508378da0be18acc238b20f5cea9c36b262
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
10
11
12
function
test
(
s
)
13
local
path
,
filename
=
split
(
s
)
14
print
(
s
..
"=["
..
path
..
"]+["
..
filename
..
"]"
)
15
end
16
17
test
(
"a:/lua/obj/lua.c"
)
18
test
(
"lua.lib"
)