【问题标题】:How I can get the value from table in Lua?如何从 Lua 中的表中获取值?
【发布时间】:2019-10-12 01:55:06
【问题描述】:

我在 lua 中有一张桌子:

localhost:3301> box.space.S24.index[1].parts
---
- - type: string
    is_nullable: false
    fieldno: 1
...

我想获得键值:fieldno。但是当我输入这段代码时:

localhost:3301> box.space.S24.index[1].parts.fieldno
---
- null
...

我得到了空值。

【问题讨论】:

    标签: lua tarantool


    【解决方案1】:

    您在输出中缺少它前面的第二个-;它是一个嵌套在数组中的数组。试试...parts[1].fieldno

    【讨论】:

      猜你喜欢
      • 2021-02-06
      • 2015-05-21
      • 2020-05-05
      • 2014-08-27
      • 2014-02-09
      • 2015-03-26
      • 1970-01-01
      • 2019-08-14
      • 2022-12-05
      相关资源
      最近更新 更多