Seuntjies DiceBot

DiceBot => Bugs and Suggestions => Topic started by: Stephov on March 16, 2019, 06:01:52 pm

Title: An error in LUA
Post by: Stephov on March 16, 2019, 06:01:52 pm
Hello!
I'm receiving the following error when my script is running.

I've found in debug mode that it happens on this row: Lua["balance"] = PreviousBalance;

And the following I've found in the DumpLog:
An error has occurred parsing the lua script., stopping
Index was outside the bounds of the array.
   at SharpLua.Lua.CallInfo.get_Item(Int32 offset)
   at SharpLua.Lua.CallInfo.inc(CallInfo& value)
   at SharpLua.Lua.traversestack(GlobalState g, LuaState l)
   at SharpLua.Lua.propagatemark(GlobalState g)
   at SharpLua.Lua.singlestep(LuaState L)
   at SharpLua.Lua.luaC_step(LuaState L)
   at SharpLua.Lua.luaC_checkGC(LuaState L)
   at SharpLua.Lua.lua_pushlstring(LuaState L, CharPtr s, UInt32 len)
   at SharpLua.Lua.lua_pushstring(LuaState L, CharPtr s)
   at SharpLua.Lua.luaB_tostring(LuaState L)
   at SharpLua.Lua.luaD_precall(LuaState L, lua_TValue func, Int32 nresults)
   at SharpLua.Lua.luaV_execute(LuaState L, Int32 nexeccalls)
   at SharpLua.Lua.luaD_call(LuaState L, lua_TValue func, Int32 nResults)
   at SharpLua.Lua.f_call(LuaState L, Object ud)
   at SharpLua.Lua.luaD_rawrunprotected(LuaState L, Pfunc f, Object ud)
   at SharpLua.Lua.luaD_pcall(LuaState L, Pfunc func, Object u, Int32 old_top, Int32 ef)
   at SharpLua.Lua.lua_pcall(LuaState L, Int32 nargs, Int32 nresults, Int32 errfunc)
   at SharpLua.LuaDLL.lua_pcall(LuaState luaState, Int32 nArgs, Int32 nResults, Int32 errfunc)
   at SharpLua.LuaInterface.DoString(String chunk, String chunkName)
   at SharpLua.LuaInterface.DoString(String chunk)
   at SharpLua.LuaRuntime.Run(String luaCode)
   at DiceBot.cDiceBot.parseScript(Bet bet) in D:\...
Title: Re: An error in LUA
Post by: Seuntjie on March 16, 2019, 11:53:21 pm
Can you provide your script or isolate the part of your script that is causing this error and provide that?
Title: Re: An error in LUA
Post by: Stephov on March 17, 2019, 03:13:58 pm
I've sent you PM
Title: Re: An error in LUA
Post by: Seuntjie on March 18, 2019, 07:11:11 am
According to the stack trace you sent, the description you gave and the script you sent me in PM, it's an error in your script. You are probably trying to access an item in an array where there isn't one for it - thus the index out of bounds array.

To test whether it's an issue with the balance variable of the bot, once it stops with the error, place a manual bet from inside the bot and then try to start it again. If there is a problem with the balance variable like you posted originally, that will resolve it. (But looking at the error and the stack trace, it cannot be caused by the line you mentioned).
Title: Re: An error in LUA
Post by: Stephov on March 19, 2019, 10:36:56 am
Check your PM please
Title: Re: An error in LUA
Post by: Seuntjie on March 21, 2019, 08:38:50 am
I am currently extremely busy and your query is rather complex and requires more time than I can give to it at the moment. I am aware of your messages and will review them when I have time.
Title: Re: An error in LUA
Post by: Stephov on March 22, 2019, 06:57:04 am
Ok, thanks.
Title: Re: An error in LUA
Post by: Stephov on March 23, 2019, 04:34:12 pm
Note that the error occurs when there is 12 rows in the "chancesArray" (as in my sample). I've tried to run it with 9 rows and there is no error. But of course, it would be better to not have any limits of rows )
Title: Re: An error in LUA
Post by: Seuntjie on March 24, 2019, 08:50:23 am
Like I said earlier, it's unlikely that the problem is internal to the bot and more likely that it's a problem with one of the arrays in your script. There isn't a limit on the size of arrays. it's more likely that the way you access that array breaks if there are 12 items in it. I've only skimmed your PMs and haven't had a chance to confirm anything, but that's my gut feeling for this issue.

I will review this once I have time to confirm/find the actual problem.
Title: Re: An error in LUA
Post by: Stephov on March 24, 2019, 11:52:23 am
Ok. I just wanted to make the problem more clear