Recipes General - AnaNek/tarantool GitHub Wiki

General

Hello world

Create a script and run it.

#!/usr/bin/env tarantool

-- Lua code
print('Hello, World!')

Create spaces at the first run

Use :func:`box.once()` to initialize database schema at the first run.

#!/usr/bin/env tarantool

-- Configure database
box.cfg {
    listen = 3313
}

-- Create spaces (once)
box.once("bootstrap", function()
    box.schema.space.create('tweedledum')
    box.space.tweedledum:create_index('primary',
        { type = 'TREE', parts = {1, 'NUM'}})
end)

-- Start interactive mode
require('console').start()
⚠️ **GitHub.com Fallback** ⚠️