summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-16 14:26:32 +0800
committerruki <[email protected]>2015-06-16 14:26:32 +0800
commit608602d0de1056f856e0b6bfe33b3f5fbe641b63 (patch)
tree845abda197164395b6ed071045d48a15c2b3e201 /xmake/scripts/base/io.lua
parentb02e5fc9da96945b0be2452bdbbf5b9801e68b69 (diff)
compile for android and ios ok
Diffstat (limited to 'xmake/scripts/base/io.lua')
-rw-r--r--xmake/scripts/base/io.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/scripts/base/io.lua b/xmake/scripts/base/io.lua
index db7c2b934..c1808f731 100644
--- a/xmake/scripts/base/io.lua
+++ b/xmake/scripts/base/io.lua
@@ -179,15 +179,26 @@ function io.load(filepath)
end
-- cat the given file
-function io.cat(filepath)
+function io.cat(filepath, linecount)
-- open file
local file = io.open(filepath, "r")
if file then
-- show file
+ local count = 1
for line in file:lines() do
+
+ -- show line
print(line)
+
+ -- end?
+ if linecount and count >= linecount then
+ break
+ end
+
+ -- update the line count
+ count = count + 1
end
-- exit file