Your solution looks pretty solid. Another way to accomplish this would be to use structs as in
integer = 1
strings = 2
floats = 3
arrays = 4
n = [.data = 123, .type = integer]
n1 = [.data = "123", .type = strings]
if n.type == integer then
//do something
endif
Keep up the good work!!