Skip to content

Instantly share code, notes, and snippets.

@iris-yeh

iris-yeh/lua.lua Secret

Created May 6, 2021 16:21

Revisions

  1. iris-yeh created this gist May 6, 2021.
    15 changes: 15 additions & 0 deletions lua.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    -- 寫個簡單的函數
    local function func()
    print('Hi')
    end

    --[[新增一個table 裡面塞入一個function 和 string
    這邊f就是key,對應的value就是func這個函數
    這邊name就是key,對應的value就是iris這個字串 ]]
    local aTable = {f = func, name = "iris"}


    -- 在table.後面加入key就可以直接使用table中的內容
    aTable.f()
    print(aTable.name)