lua-l archive
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
] [
Date Index
] [
Thread Index
]
Subject
:
Re: table.clear
From
: Egor Skriptunoff <egor.skriptunoff@
...
>
Date
: Wed, 26 Sep 2018 21:18:50 +0300
On Wed, Sep 26, 2018 at 3:20 PM, Dirk Laurie wrote:
table.clear = function(tbl)
local n=#tbl
table.move(tbl,n+1,2*n,1)
end
Negative indices don't have "backwards" meaning in table.move(), so we can write more compact code
table.clear = function(tbl)
table.move(tbl, -#tbl, -1, 1)
end
Follow-Ups
:
Re: table.clear
,
Dirk Laurie
References
:
table.clear
,
Dirk Laurie
Prev by Date:
Re: table.clear
Next by Date:
Re: table.clear
Previous by thread:
Re: table.clear
Next by thread:
Re: table.clear
Index(es):
Date
Thread