Skip to main content

# Create A Table (LCC.db.create)

## Signature​

    ok, err = LCC.db.create(name, columns, timeout?)

## Parameters​

- name
  String. Table name. Must be non-empty and no longer than 256 bytes.
- columns
  Table. Array of column names. Each name must be non-empty valid UTF-8, must not repeat, and must not be `id`.
- timeout
  Number, optional. Request timeout in seconds, default `60`.

## Returns​

- ok
  Boolean. `true` on success, `false` on failure.
- err
  String or `nil`. Error message on failure; `'table already exists'` when the table is present.

## Notes​

> Creates a new table; every user column is stored as `TEXT`, and an auto-increment `id` is added automatically.
> Empty or oversized names and non-UTF-8 column names raise Lua parameter errors before the request is sent.
> Duplicate column names return an error.

## Example​

    local ok, err = LCC.db.create("tasks", {"Name", "Status", "Remark"})
    if not ok then
        error(err)
    end