I want to pass a lua reference to another function without actually using assignment =
but something like loadstring
.
local myTable = { test="Hello" }
local myTableStringified = tostring(myTable) -- table: 0xref
print(myTableStringified)
local myTableUnstringified = loadstring(myTableStringified)
print(myTableUnstringified) -- nil but should show table: 0xref
As seen above, this won't do.
You'll have to use one of the modules that provide serialization.
Keep in mind that loadstring
returns a function that needs to be called, so to get the table back you need to use loadstring(myTableStringified)()
.