How can I undefine a variable and free resources?

Q

How can I undefine a variable and free resources?

A

Since variables are managed in tables internally, a variable without an assigned value does not have an entry in the table and therefore the value nil. Using the assignment myvariable = nil an existing variable can be removed from the table again. Also previously occupied resources are released by this statement.