Added panic protection, C functions for dealing with tables that have table/function type keys