space_object:frommap()
space_object
Convert a map to a tuple instance or to a table. The map must consist of
"field name = value" pairs. The field names and the value types must
match names and types stated previously for the space, via
/reference/reference_lua/box_space/format.
Parameters:
-
space_object(space_object) — an object reference -
map(field-value-pairs) — a series of "field = value" pairs, in any order. -
option(boolean) — the only legal option is{table = true|false}; BR if the option is omitted or if{table = false}, then return type will be 'cdata' (i.e. tuple); BR if{table = true}, then return type will be 'table'.
Returns
a tuple instance or table.
Return type
tuple or table
Possible errors: space_object does not exist or has no format;
"unknown field".
Example:
-- Create a format with two fields named 'a' and 'b'.-- Create a space with that format.-- Create a tuple based on a map consistent with that space.-- Create a table based on a map consistent with that space.tarantool> format1 = {{name='a',type='unsigned'},{name='b',type='scalar'}}---...tarantool> s = box.schema.create_space('test', {format = format1})---...tarantool> s:frommap({b = 'x', a = 123456})---- [123456, 'x']...tarantool> s:frommap({b = 'x', a = 123456}, {table = true})---- - 123456- x...