|
Duncan Cross wrote:
The purpose of that function is to set a metatable for the base "string" type, so that method calls on a string instance will call functions in the string library. For example: a = "Blah blah blah" b = a:upper() ...becomes equivalent to: a = "Blah blah blah" b = string.upper(a) Unlike tables (and full userdata), which can each individually have their own metatable, the base types (string, number, boolean, etc.) each have a shared metatable that is used by all values of that type.
Beautiful! Now the next step is to figure out how to delete that metatable programmatically so that when I do string = nil to get rid of the string library, it is also deleted from _LOADED and garbage collected. Ralph