Giter Site home page Giter Site logo

luadcpy's Introduction

Overview

The dcpy Lua (5.1) library is a library containing functions for customizable deep copying of tables. A table of 3 functions is returned when requiring this file.


  • basic( t )

This function is a basic deep copy. The original metatables are applied to values and keys remain their originals whilst values are recursively deep copied. This function is defined as

basic = create{
	["recursive"] = true,
	["copymts"] = true,
	["inckeys"] = false,
	["incmts"] = false
}

  • shallow( t )

This function is a basic shallow copy. The original metatable is not applied to values and keys remain their originals whilst values are non-recursively copied. This function is defined as

shallow = create{
	["recursive"] = false,
	["copymts"] = false,
	["inckeys"] = false,
	["incmts"] = false
}

  • create( t )

This function creates and returns copying functions. The input table t determines what copy function is returned. All fields are treated as booleans. The format for the input table is as follows:

Key Description
"recursive" Determines whether the function is recursive or not.
"copymts" Determines if table values, when copied, have their metatables copied to them, too. Without "incmts" being true, this "copy" is actually just the original metatable.
"inckeys" Determines whether keys are included in the copying process. If they are, keys are treated just as values are and are copied in the same way.
"incmts" Determines whether metatables, when copied, use the original (when == false) or a copy (when == true). Copied metatables are copied in the same way as values.

luadcpy's People

Contributors

ocornoc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.