The code t = type(nil) results in an error rather than t being set to "nil". This also occurs with t = type(a) where a has a nil value.
t = type(nil)
t = type(a)
Thank you for the report !
Bug fixed, will be available in next update.