14 lines
541 B
Text
14 lines
541 B
Text
local proc f1(x) print(x); return x end
|
|
|
|
# t is a constant table, its contents can change but t itself cannot be assigned to
|
|
local constant t := [ "foo" ~ "bar"
|
|
, "baz" ~ 6
|
|
, fortytwo ~ 7
|
|
, 42 ~ [ 1, 2, 3 ]
|
|
, "zz" ~ f1
|
|
];
|
|
t[ f1 ] := true; # keys that aren't strings or numbers need to be added via assignments
|
|
|
|
for key, val in pairs( t ) do
|
|
printf( "%24s (%9s) -> (%9s) %-24s \n", key, type( key ), type( val ), val )
|
|
od
|