Jump to content
  • 0

ArrayIndexOutOfBoundsException problem


BadCase
 Share

Question

I have an Array that I know has 57 values as i printed the array and it its value count prior to running the following

for i,v in ipairs(newpids) do
    check = string.find(ids, v)
    if check ~= nil then
        --do stuff
    else
        --do other stuff

    end

end

And I get the following

ArrayIndexOutOfBoundsException: length=12: index=12

which is not making any sense since I know the array is 57 values long or I may be misunderstanding something here

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

thanks for the reply, this is a private script so I can't post it but if I encounter it in another one I will revisit this thread

Need full text of error and full text of script for reproduce it.
Link to comment
Share on other sites

  • 0
7 hours ago, Enyby said:

Full text of error too private?

Is this it or is therer more in a file somewhere?

 

Script ended:
Perhaps this script needs the latest version of GameGuardian. Try to update to the latest version.

Script error: org.luaj.vm2.LuaError: @/storage/emulated/0/Download/SaveEditorPACYBITSfutBadCase1.0.0.lua:86
`    check = string.find(ids, v)`
vm error: java.lang.ArrayIndexOutOfBoundsException: length=12; index=12
level = 1, pc = 160
stack traceback:
    /storage/emulated/0/Download/SaveEditorPACYBITSfutBadCase1.0.0.lua:86 in function 'loadxml'
    /storage/emulated/0/Download/SaveEditorPACYBITSfutBadCase1.0.0.lua:5 in function 'home'
    /storage/emulated/0/Download/SaveEditorPACYBITSfutBadCase1.0.0.lua:738 in main chunk
    [Java]: in ?
    at org.luaj.vm2.LuaClosure.execute(LuaClosure.java:583)
    at org.luaj.vm2.LuaClosure.call(LuaClosure.java:145)
    at org.luaj.vm2.LuaClosure.execute(LuaClosure.java:427)
    at org.luaj.vm2.LuaClosure.call(LuaClosure.java:145)
    at org.luaj.vm2.LuaClosure.execute(LuaClosure.java:427)
    at org.luaj.vm2.LuaClosure.call(LuaClosure.java:145)
    at android.ext.Script.runScript(Script.java:5096)
    at android.ext.Script$ScriptThread.run(Script.java:4896)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=12; index=12
    at org.luaj.vm2.LuaString.luaByte(LuaString.java:576)
    at org.luaj.vm2.lib.StringLib$MatchState.classend(StringLib.java:1016)
    at org.luaj.vm2.lib.StringLib$MatchState.match(StringLib.java:1132)
    at org.luaj.vm2.lib.StringLib.str_find_aux(StringLib.java:816)
    at org.luaj.vm2.lib.StringLib$find.invoke(StringLib.java:225)
    at org.luaj.vm2.lib.VarArgFunction.call(VarArgFunction.java:62)
    at org.luaj.vm2.LuaClosure.execute(LuaClosure.java:433)
    ... 7 more


Script wrote 38.63KB in 1 files

Link to comment
Share on other sites

  • 0
2 hours ago, Enyby said:

Mistake in pattern. Not closed a frontier pattern. Something like that:


ids = '01234567890'
v = '01234567%f[%'
check = string.find(ids, v)
print(check, ids, v)

 

yup i bet that is it just looked at the array again and a [ made it through my file parsing and is at the beginning of the first array value, Thanks again for the help

Edited by BadCase
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.