The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: 'SymbolSTRSLICE' object has... (*solved*)
#5
I've found out the line that caused the compiling error:

Code:
let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1)))

In fact the same calculation is used in two functions, with the same effect.

The context is:

Code:
dim genderEnding(1 to 3) as string dim genderTypes as string let genderTypes="12333131333" ' gender type for every portable thing let genderEnding(1)="A" ' ending for gender type 1 let genderEnding(2)="AS" ' ending for gender type 2 let genderEnding(3)="" ' ending for gender type 3 (or "O", calculated in the function) function undefinedArticleEnding(thing as ubyte) as string dim ending as string let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1))) return ending end function

I isolated the function and the needed DIMs into another file, to debug it. Here you are the results, in chronological order. Every try is marked "!!!ERROR" or "!!!fine and then commented out:

Code:
dim genderEnding(1 to 3) as string dim genderTypes as string let genderTypes="12333131333" ' gender type for every portable thing let genderEnding(1)="A" ' ending for gender type 1 let genderEnding(2)="AS" ' ending for gender type 2 let genderEnding(3)="" ' ending for gender type 3 (or "O", calculated in the function) function undefinedArticleEnding(thing as ubyte) as string dim ending as string ' let ending = genderEnding(val(genderTypes(thing-firstPortableThing+1))) ' !!!ERROR ' let ending = genderEnding(val(genderTypes(thing-firstPortableThing))) ' !!!ERROR ' let ending = "O" ' !!!fine ' let ending = genderEnding(val(genderTypes(thing))) ' !!!ERROR ' let ending = genderEnding(1) ' !!!fine ' let ending = genderEnding(val("1")) ' !!!fine ' let ending = genderEnding(val(genderTypes(1))) ' !!!ERROR ' let ending = genderEnding(val(genderTypes(0))) ' !!!ERROR ' let ending = genderEnding(val("0")) ' !!!fine, a different error: out of range ' In parts !!ERROR ' dim gt as ubyte ' let gt = val(genderTypes(1)) ' let ending = genderEnding(gt) ' In parts !!!fine ' dim gt as ubyte ' let gt = val("1") ' let ending = genderEnding(gt) ' In parts !!!fine ' dim gt as ubyte ' dim gs as string ' let gs = "1" ' let gt = val(gs) ' let ending = genderEnding(gt) ' In parts !!!fine ' dim gt as ubyte ' dim gs as string ' let gs = genderTypes(1) ' let gt = val(gs) ' let ending = genderEnding(gt) ' In parts !!!fine dim gs as string let gs = genderTypes(1) let ending = genderEnding(val(gs)) return ending end function

I don't understand what's wrong in the code. I suspect it's a compiler issue. I think it has something to do with nesting, don't you think so?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)