Skip to content
Discussion options

You must be logged in to vote

If you are going to be assigning random key names that can not be foreseen (and therefor documented with @field), you will have to do the following:

---@type table<string, any>
local x = {
    name = "me",
    nickName = "M"
}

local fieldName = "name"
x[fieldName] = nil

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@muppet9010
Comment options

@carsakiller
Comment options

Answer selected by muppet9010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants