Re: Confusing error message for nil-indexed C arrays

  • From: Henk Boom <henk@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 3 Aug 2012 20:14:16 -0400

On 3 August 2012 17:42, demetri <demetri.spanos@xxxxxxxxx> wrote:
>> Well, the error is generic. What if you index an array with e.g.
>> 'true' or a table as a key?
>
>
> FWIW when I first started playing with the FFI I had the same
> head-scratching reaction; what could it mean that an array can't be indexed?
>
> It only takes a moment to realize that it means a non-numeric index, but it
> may be slightly more communicative (and slightly more technically correct)
> to say "int [?] can only be indexed by a numerical offset".

Or if that's too specific, maybe just "int[?] cannot be indexed by this value".

    henk

Other related posts: