-
deveyus
- Posts: 14
- Joined: Tue Dec 14, 2010 10:02 pm
#1
Post
by deveyus » Fri Dec 24, 2010 7:37 am
I seem to be failing at making a very simple piece of code work. It seems that it just causes the bot to hang, but I don't know enough to know what I'm doing wrong as I'm operating by example.
Code: Select all
filename = getExecutionPath() .. "/logs/" .. io.stdin:read() .. ".txt";
toFileLine ="Harvested: %s, %d \n", arg1.X, arg1.Z;
file, err = io.open(filename, "w");
file:write(toFileLine);
file:close();
-
Administrator
- Site Admin
- Posts: 5333
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Fri Dec 24, 2010 11:11 am
Probably because you're telling it to wait for user input (io.stdin:read()). I don't know why you would ever possibly want to ask the user for the filename every time it attempts to harvest something. Get rid of that and just replace it with:
Code: Select all
filename = getExecutionPath() .. "/logs/harvest.txt";
-
deveyus
- Posts: 14
- Joined: Tue Dec 14, 2010 10:02 pm
#3
Post
by deveyus » Fri Dec 24, 2010 4:59 pm
Because I was learning by using createpath.lua at 7am with no sleep. That's why. Thanks much though!
Who is online
Users browsing this forum: Bing [Bot] and 7 guests