From 1d27518fb7abf52857b50c694a5db4ced80c9f15 Mon Sep 17 00:00:00 2001 From: ne_mene Date: Tue, 31 Mar 2026 11:35:48 +0200 Subject: table deep copy --- src/objs/player.lua | 1 - src/utils.lua | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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 } -- cgit v1.3-2-g0d8e