lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The use case is to have a hierarchical series of sandbox environments, each deriving from the last.

--------------------------------------------------
From: "Benjamin Tolputt" <btolputt@bigpond.net.au>
Sent: Monday, September 28, 2009 P2:45
Newsgroups: gmane.comp.lang.lua.general
To: "Lua list" <lua@bazar2.conectiva.com.br>
Subject: Re: Transparent shallow copy of tables

Stuart P.Bentley wrote:
How can I do a shallow copy of a table that operates identically to
the original? Currently I'm setting tables to be empty tables with
metatables that save deletions and create similar shallow copies on
index access, but this is causing problems with functions like
table.concat().

I'd prefer to avoid a deep copy if possible, since that would take a
long time regardless of access depth.

This sounds like an idea I had for the capability to commit or roll-back
changes to process state as a form of transactional memory. The issue is
that this would need to be applied to all tables Lua constructed, which
would necessarily slow down the system (too much?).

What is the use case for this?

--
Regards,

Benjamin Tolputt
Analyst Programmer