Skip to content

Straightforward distinguishing between arrays and maps #89

Open
@zaglex

Description

@zaglex

Conversion from php-array to lua-table may be little bit tricky.

Consider the case:

$data[0] = 'a';
$data[1] = 'b';
$data[2] = 'c';
$tarantool->call('myfunc', [$data]);

On lua side you will se such a table:

data[0] == nil
data[1] == 'a'
data[2] == 'b'
data[3] == 'c'

But then you do this on php-side:

unset($data[1]);
$tarantool->call('myfunc', [$data]);

And on lua side you will se this:

data[0] == 'a'
data[1] == 'nil'
data[2] == 'c'

I understand why it happens, but anyway this may be confusing and may cause unexpected errors.

Is there any way to force tarantool client to trait array either as "real array" or as "map"? Would be great to have special classes like MessagePackArray and MessagePackMap, or even LuaArray and LuaTable for this purpose.

Metadata

Metadata

Assignees

Labels

featureA new functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions