lua-users home
lua-l archive

Re: [LuaJIT FFI] tonumber() and cdata

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Duncan Cross wrote:
> However, it *does* throw an error if you give it an FFI cdata value
> which is non-numeric:
> 
> print(tonumber(ffi.new 'struct { }')) --> (!) cannot convert struct to double
> 
> I believe this should be changed, to be consistent with the general case.
I've changed the semantics to return nil on non-numbers.
--Mike

AltStyle によって変換されたページ (->オリジナル) /