[Request] Example script of file i/o
- Administrator
- Site Admin
- Posts: 5329
- Joined: Sat Jan 05, 2008 4:21 pm
Re: [Request] Example script of file i/o
http://www.lua.org/pil/21.1.html
Also see: http://www.lua.org/manual/5.1/
Also see: http://www.lua.org/manual/5.1/
Code: Select all
local readfile = io.open("filename.txt", "r");
if( not readfile ) then
error("Something is wrong.", 0);
end
local num, str, line;
num = readfile:read("*n 24 *l");
-- *n means "read a number", 24 means "read a string up to 24 characters long", and *l means "read a whole line as a string"
Re: [Request] Example script of file i/o
Oh yeah, didn't know it was a lua function 

Re: [Request] Example script of file i/o
Where can I look up how to use this function in general?
What you put there still leaves me with several questions, but I won't bother you with them all, considering that they are probably all answered in a manual somewhere.
What you put there still leaves me with several questions, but I won't bother you with them all, considering that they are probably all answered in a manual somewhere.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: [Request] Example script of file i/o
http://www.lua.org/manual/5.1/Rishijin wrote:Where can I look up how to use this function in general?
What you put there still leaves me with several questions, but I won't bother you with them all, considering that they are probably all answered in a manual somewhere.
There's a documentation about the functions down there too.
You can also try this: http://luaforge.net/projects/lualangpack/ (I'm not sure if there's a newer version).
It basically integrates LUA into VS2005, including IntelliSense support.
Re: [Request] Example script of file i/o
Wow I seemed to have missed all of the obvious manuals and links.
I need to stop the insomnia surfing.
Integrating lua into VS sounds very useful, thanks for the link.
I need to stop the insomnia surfing.
Integrating lua into VS sounds very useful, thanks for the link.
Who is online
Users browsing this forum: No registered users and 2 guests