Confusing error message for nil-indexed C arrays

  • From: Markus Walther <dr.marikos@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 2 Aug 2012 23:28:29 +0200

Hi Mike,

today I got this error message (by accident in a buggy program):

> local array = (require 'ffi').new('int[?]',1) ; array[nil] = 1;
stdin:1: 'int [?]' cannot be indexed

Arguably this is confusing. Contrast the error message if we use a
nil-indexed Lua array instead:

> local array = {0} ; array[nil] = 1
stdin:1: table index is nil

Q: Could we have something like "'int[?]' index is nil" instead?

-- Markus
Bond: "Everybody needs a hobby." Villain: "What's yours?" Bond: "Resurrection."

(007: Skyfall Trailer, http://www.youtube.com/watch?v=tveYIIM1qf8#t=1m51s)

Other related posts: