Re: function to check if a symbol in a library exists or not

  • From: Cosmin Apreutesei <cosmin.apreutesei@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 30 Jul 2012 13:48:34 +0300

> This did come up before and it seems unlikely to change. Nil is a
> valid result for a symbol (null) for a start.

I thought null symbols convert to a cdata null pointer, not nil. Did
that changed? I don't have a library with this case at hand to check

> Also pcall has no
> particular overhead on luajit so there is no real reason not to use
> it.

I'm ok with this implementation or other, I just thought the
functionality is useful enough to be part of luajit.

> Also you can always memoize yourself in a table if it is
> worthwhile, or test for functionality at library load time.

Memoization is fine for module globals, but I can't memoize directly
into the ffi.metatype() table because ffi doesn't allow it (I find
that it works but the manual says don't do it).

Other related posts: