Hello,
This is an issue I've had to hack around before. The best way I've
found to fix it is to convert all of your objects to object handles.
item@[] lookup(string keyword)
It might be a bit of work, but its so much better to use handles
anyway that you won't regret it.
In fact, I would probably write the line
item@[]@ lookup(string keyword)
such that we are not only using an array of handles, but we're
returning a handle to the array itself.
You also really can't take proper advantage of inheritance with out
using handles.
If this is beyond your current knowledge of BGT, I suggest researching
handles, if not also inheritance. Handles are amazing things that will
probably make your game run faster, too!
Best,
Aaron

On 8/7/16, john <jpcarnemo...@gmail.com> wrote:
> Hi All,
>
> I've been hacking at a project for a couple weeks now, and am getting some
> rather confusing array-related errors when trying to compile.
>
> I've seen these before, but they usually only occur when trying to use
> objects with nondefault constructors in arrays in some fashion.
>
> In this case, its a method declaration line that seems to be breaking:
>
>
>
> item[] lookup(string keyword)
>
> The error is:
>
>
>
> File: array
>
> On line: 0 (0)
>
> Error: The subtype has no default factory
>
> File:
>
> On line: 20 (1)
>
> Information: Compiling <unknown> database::lookup(string)
>
>
>
> The item class is fully valid and included in the script.
>
> The lookup function is as follows:
>
>
>
> item[] lookup(string keyword)
>
> //This function returns a list of items that can be referenced by a given
> keyword.
>
> {
>
> item[] results;//Note that this line doesn't break, just the function
> declaration
>
> for(int count=0; count<contents.length(); count++)//loop through database
> contents, checking each item
>
> {
>
> if(contents[count].check(keyword)) results.insert_last(contents[count]);
>
> }
>
> return results;
>
> }
>
>
>
> If anybody has a clue what's going on here, I'd really appreciate some
> help.
>
> Also, if you know how to use objects that have constructors with arguments
> in arrays, I'd love to know too; that particular issue has been costing me a
> tremendous amount of debugging and fixing time.
>
>
>
> Thanks,
>
> John
> ---
> Gamers mailing list __ Gamers@audyssey.org
> If you want to leave the list, send E-mail to
> gamers-unsubscr...@audyssey.org.
> You can make changes or update your subscription via the web, at
> http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
> All messages are archived and can be searched and read at
> http://www.mail-archive.com/gamers@audyssey.org.
> If you have any questions or concerns regarding the management of the list,
> please send E-mail to gamers-ow...@audyssey.org.
>

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to