function

global.using

Signature

function using(
  t: table<any, any> | string,
  opts: {
    into:   table<string: any> = _G,
    root:   table<string: any> = _G,
    dups:   table<string: any> = {},
    rename: table<string: string>
  }
) -> opts.into, opts.dups

Copies all values from t into opts.into, that is, for each key k in t, executes opts.into[k] = t[k].

If t is a string, it is interpreted as a dot-separated path to a table, relative to opts.root.

Duplicates are stored in opts.dups before assignment. That is, for each key k that exists in both t and opts.into, opts.dups[k] = t[k] before opts.into[k] = t[k].

If opts.rename is present, it is used to map keys. For example, {select='myselect'} would result in opts.into.myselect = t.select. An empty string means omit this value.