Jump to content




Todolist - Can't find the error


6 replies to this topic

#1 Azami1990

  • Members
  • 6 posts

Posted 09 August 2016 - 05:01 PM

Hey Guys,

first of all, sorry for my (bad?) english ;)

i'm working on a Todo-List (rewrite a script i found) and i'm on a point where i can't find the error.

First, here is my Code: http://pastebin.com/XmXqtk32
And a Todo-List (save as "tasks"): http://pastebin.com/9y3NwDAz

My List is working great but when i get to the last page, i get a "122: index expected, got nil" and on page 3+ the second Item is always highlighted.
My coding skills are very semi so maybe its just a logical flaw something like that.

I hope you can help me with my Script!

Greetings
Azami1990

#2 DoganLark

  • Members
  • 6 posts

Posted 10 August 2016 - 10:53 AM

Strange, are you sure you posted the right code? The line doesn't look like it should throw an error. Also I can't manage to reproduce the error.

#3 Azami1990

  • Members
  • 6 posts

Posted 10 August 2016 - 04:21 PM

yep, its the right code (via pastebin put)

Here are some screens:
Error with Notepad++ in Background
Code in CC

Maybe it's a problem with the Modpack? Resonant Rise 3 (3.4.0.1) and CC 1.75

EDIT: Whoop. Its Line 112 not 122 :wacko:

Edited by Azami1990, 10 August 2016 - 07:58 PM.


#4 The_Cat

  • Members
  • 119 posts

Posted 10 August 2016 - 09:44 PM

My guess is that tasks[p3-1+line].checked doesnt exist in the table as it expected index but got a nil value.

#5 Azami1990

  • Members
  • 6 posts

Posted 10 August 2016 - 11:52 PM

Found two fault.
Line 102 was: if p3-1 <= (line + 13 < #tasks and line + 13 or #tasks) and p3-1 >= 1 then
But it should be: if p3-1 <= 13 and p3-1 >= 1 then.
I dont know why i wrote the original if but the "mouse_click" should be between the second and 14 line on the Terminal :/

And i need to add a check on line 37 if its the last page and how much items are left. (for i=1+line2, (line2 + (line2+13 > #tasks and #tasks-line or 0) == #tasks and line2+1 or 13+line2) do)

But now i've got a new problem. When i'm on the last Page and i click on the "next page button" he try to get on a new Page and i get a new error (sure, there are no items to be displayed). How can I prevent this?

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 August 2016 - 01:32 AM

View PostAzami1990, on 10 August 2016 - 11:52 PM, said:

i get a new error

... which says...?

#7 Azami1990

  • Members
  • 6 posts

Posted 11 August 2016 - 01:07 PM

Sorry, was late and tired.
Its working now. Some sleep and a shove from you guys and in found all my faults :wacko:/&gt;
Here is the working code if someone is interested in it or want to "finetune" it: http://pastebin.com/nJenRqZS
Thanks guys!

Edited by Azami1990, 11 August 2016 - 04:50 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users