1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-27 12:38:45 +00:00

fix of modifyRow

This commit is contained in:
InsanusMokrassar 2024-11-11 13:37:20 +06:00
parent 41e369cea5
commit 5ce4e4cbc0

View File

@ -97,9 +97,10 @@ open class MatrixBuilder<T> {
exists.forEach { rowBuilder.add(it) } exists.forEach { rowBuilder.add(it) }
mutMatrix[i] = rowBuilder.apply(block).row mutMatrix[i] = rowBuilder.apply(block).row
} }
fun modifyRow(row: List<T>, block: RowBuilder<T>.() -> Unit) { fun modifyRow(row: List<T>, block: RowBuilder<T>.() -> Unit): Boolean {
val i = mutMatrix.indexOf(row).takeIf { it > -1 } ?: return false val i = mutMatrix.indexOf(row).takeIf { it > -1 } ?: return false
modifyRow(i, block) modifyRow(i, block)
return true
} }
fun remove(i: Int): List<T> { fun remove(i: Int): List<T> {
return mutMatrix.removeAt(i) return mutMatrix.removeAt(i)