信息发布→ 登录 注册 退出

Lua中table里内嵌table的例子

发布时间:2026-01-11

点击量:

废话不多少,看代码:
复制代码 代码如下:
local temp_insert_table_Data = { 
    x = "test3",   
    y = "test4",   
    z = "test5" , 

 
local temp_insert_table = { 
    x = 1, 
    y = 2, 
    z = 3, 
    {   a = -1, a1 = 1}, 
    {   b = -2, b1 = 2}, 
    {   c = -3, c1 = 3}, 
     
    temp_insert_table_Data_ = temp_insert_table_Data, 
 

 
temp_insert_table.temp_insert_table_Data_ = temp_insert_table_Data 
 
print(temp_insert_table.y) 
print(temp_insert_table[1].a) 
print(temp_insert_table.temp_insert_table_Data_.x) 

可以直接通过table_name去访问成员数据!
输出结果:
复制代码 代码如下:
2
-1
test3

在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!