Post
Topic
Board Gambling
Re: Seuntjies DiceBot -Multi-Site, multi-strategy betting bot for dice. With Charts!
by
realduit
on 08/01/2017, 16:36:25 UTC
In Programming Mode :

i want record rolll in file, i use

file=io.open("rec1.txt","a")
io.output(file)
io.write("text test")
io.close(file)


LUAR ERROR!!
[string"chunk"]:4: bad argument #1 to 'close (FILE * expected, got nil)

but the code runs well on console
lua text1.txt

Why do you want to record the roll in the file? All bets are stored in a sqlite DB called dicebot.db. You can view previous bets using the bet history form (view->bet history) or by using like sqlitebrowser to query the file directly

You're probably trying to close the file while it's still writing, or opening the file too many times in too quick succession, or something. Try opening the file once when you start the script and then write to the file without closing it, and only close the file when you stop the bot. (do this manually using the console)


I want to record a particular roll with the formula that I created, to be analyzed in a spreadsheet.

I tried the file access code:
[1] fl = io.open ("c: \ test1.txt", "a")
[2] print(fl)

result : no output *nil

code line [1] does not create a new file "c:\test1.txt"
Also although I made manully  file "c:\test1.txt" but file can not be access with io.open method.

* I tried in fedora console using lua filename, io.open can run well
* Dicebot applications run on VPS Windows 2008 R2