Re: Confusing error message for nil-indexed C arrays

  • From: Mike Pall <mike-1208@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 3 Aug 2012 23:31:16 +0200

Markus Walther wrote:
> > local array = (require 'ffi').new('int[?]',1) ; array[nil] = 1;
> stdin:1: 'int [?]' cannot be indexed
> [...]
> Q: Could we have something like "'int[?]' index is nil" instead?

Well, the error is generic. What if you index an array with e.g.
'true' or a table as a key? Would it help to use

  '%s' cannot be indexed with '%s'
  'int [?]' cannot be indexed with 'nil'



Other related posts: