-- This function takes a string (a value type) and a table (reference type). -- The value and the reference are copied to their respective parameters. local function f(s, t) assert(type(s) == "string", "First parameter must be a string.") assert(type(t) == "table", "Second parameter must be a table.") -- Add the first argument to the table. t:insert(s) -- the original 't' will reflect this -- Mutate the first argument by reversing it. s = s:reverse() -- the original 's' will not reflect this end local s = "pluto" local t = {"uranus", "neptune"} f(s, t) print(t:concat(", ")) print(s)