Hello Guest

Itterate through getHistory

  • 5 Replies
  • 92 Views
*

GonerGenesis

  • *
  • 4
  • +0/-0
    • View Profile
Itterate through getHistory
« on: February 24, 2019, 12:28:25 am »
Hi,
I started to code a lua script and therefore i'd like to get my bet history for initialization. Whatever ... since getHistory don't gives back a table but Dicebot.Bet[] i'm not sure how i can get the length of this array.
Cheers

*

Seuntjie

  • *****
  • 217
  • +0/-1
    • View Profile
Re: Itterate through getHistory
« Reply #1 on: February 24, 2019, 07:54:18 am »
the value returned is a c# array, so any normal c# array actions can be used on it, for example .Length. Since it's an array of of bets, each object in the array has the same properties as the lastBet variable typically used.

*

GonerGenesis

  • *
  • 4
  • +0/-0
    • View Profile
Re: Itterate through getHistory
« Reply #2 on: February 24, 2019, 08:07:43 am »
great, thx alot

*

GonerGenesis

  • *
  • 4
  • +0/-0
    • View Profile
Re: Itterate through getHistory
« Reply #3 on: March 01, 2019, 09:22:23 pm »
Hi,

since you mentioned in your manuals that getHistory() is quiet IO-expensive. I'd like to use getHistoryByQuery() ... Since I'm not very familiar with SQL could you provide me with an example to get all or possibly only the last bet with a Roll > 75?

Cheers,

*

Seuntjie

  • *****
  • 217
  • +0/-1
    • View Profile
Re: Itterate through getHistory
« Reply #4 on: March 01, 2019, 09:27:31 pm »
All of the gethistory functions are IO expensive since they almost always need to do full table scans. I would recommend doing it once when you start your script and maintaining the list of bets from there on out within your script instead of calling any of the gethistory functions after every bet.

Try something like 'select * from bets where lucky>75'

If that doesn't work, just open the database file in sqlitebrowser and check what the column name is, and try executing the sql query directly on the database to ensure it works and you get data back from your query

*

GonerGenesis

  • *
  • 4
  • +0/-0
    • View Profile
Re: Itterate through getHistory
« Reply #5 on: March 03, 2019, 12:17:39 pm »
Thanks for the tipp. Finally i'm going to extract the information via db browser and than try to read in the data as csv in the bot script.