Shouldn't this work?
import tables
type
Letters = enum
A = 14,
B = 24,
C = 31
var
table: Table[string, int16] = { "aaa": A, "bbb": B }.toTable
converter toInt16(val: Letters): int16 =
result = int16(val)
I experimented a bit:
import tables
type
Letters = enum
A = 14,
B = 24,
C = 31
#seems useless here
#converter toInt16(x: Letters): int16 = int16(x)
converter toInt16(x: untyped): (string, int16) = (x[0], int16(x[1]))
# wont work
#let a: array[3, (string, int16)]= { "key1": A, "key2": B, "key3": C}
# works
let a = { "key1": int16(A), "key2": B, "key3": C}
let b = a.toTable
echo b