diff options
| author | ne_mene <[email protected]> | 2026-03-31 11:35:48 +0200 |
|---|---|---|
| committer | ne_mene <[email protected]> | 2026-03-31 11:35:48 +0200 |
| commit | 1d27518fb7abf52857b50c694a5db4ced80c9f15 (patch) | |
| tree | 452dc0ce881c91ef7ef408ffdb21ea9c3a276308 /src | |
| parent | e3e9d4013853903a2ab76c18328d646d53e4e085 (diff) | |
table deep copy
Diffstat (limited to 'src')
| -rw-r--r-- | src/objs/player.lua | 1 | ||||
| -rw-r--r-- | src/utils.lua | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/objs/player.lua b/src/objs/player.lua index ffc9fde..55a8ebe 100644 --- a/src/objs/player.lua +++ b/src/objs/player.lua @@ -136,6 +136,5 @@ function new_player(x, y) exit = player_dash_state_exit, }, }) - return ent end diff --git a/src/utils.lua b/src/utils.lua index 5795592..5b8258c 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -117,6 +117,18 @@ function table.shallow_copy(t) return t2 end +function table.deep_copy(datatable) + local tblRes={} + if type(datatable)=="table" then + for k,v in pairs(datatable) do + tblRes[table.deep_copy(k)] = table.deep_copy(v) + end + else + tblRes=datatable + end + return tblRes +end + EASING_FUNCTIONS = { Lerp = lerp } |
