Hi Piotr,
there is always a little danger if someone tries to use creative codings and explores undocumented stuff. So be prepared that this behavior may change with later updates...
But to answer your question....
I guess your code can be improved by using the [lrange] command to filter the relevant key names before passing the retrived [list] to the [foreach] loop. But I haven't tested out the performance differences...
set keys_current [table keys -subtable master -count]
set keys_to_remove 10
foreach key [lrange [table keys -subtable master] [expr { $keys_current - $keys_to_remove + 1 }] $keys_current] {
table delete -subtable master $key
}
Cheers, Kai