Tables

Table Flat

Access and write tables using dot "." notation, also known as "flat path". Similar to TweakDB Flat logic but for any kind of LUA table.

Definitions

tFlat.get(obj: table, path: string, opt default: any) -> value/default
tFlat.has(obj: table, path: string) -> boolean
tFlat.set(obj: table, path: string, value: any) -> table
tFlat.insert(obj: table, path: string, value: any) -> table
tFlat.delete(obj: table, path: string) -> table

Usage examples

All code examples below use this predefined table data. Note that items is an associative object and elements is a sequential table.

local myTable = {
    ready = true,
    config = {
        items = {
            item1 = true,
            item2 = false
        },
        elements = {
           'element1',
           'element2'
        }
    }
}

Get value

Has value

Set value

Insert sequential table value

Delete value

Source code

Last updated