Removing unpack() cap

] lua_run_cl filex.Append( “HelixScripts/tables/_R.txt”, unpack( _R ) )
:1: too many results to unpack


No really… Is it possible to remove this annoying protection?


Well… I tryed this: lua_run_cl filex.Append( “HelixScripts/tables/_R.txt”, util.TableToKeyValues( _R ) )
It crashed my Garry’s Mod with the error: Lua Error Dump
Looks like i’ll never see the true secrets that lie in the _R metatable.



Obviously, you won’t be able to save the contents to a file using that.


Also, you can only unpack sequential tables.

Copy - Paste :dance:


Or you could probably write a PrintTable function that would write to a file.

Or you could just copypasta the PrintTable function out of utils.lua and edit it a bit to save to a file.

Ah that’s where it’s hidden! Thanks, I was looking for it.

You think I didn’t know PrintTable…? Sigh… I’ll find a way to save it.

Untested but probably works :
[lua]local OutputString = “”

function WriteTable(t,filename)
file.Write(“tables/”…filename…".txt", OutputString)
OutputString = “”

local function AddToOutput(str)
OutputString = OutputString + str

local function ReadTable( t, indent, done )

done = done or {}
indent = indent or 0

for key, value in pairs (t) do

	AddToOutput( string.rep ("	", indent) )

	if type (value) == "table" and not done [value] then

      		done [value] = true
      		AddToOutput(tostring (key) .. ":" .. "

ReadTable (value, indent + 2, done)


      		AddToOutput(tostring (key) .. "	=	")
      		AddToOutput(tostring(value) .. "





This is a modified PrintTable

wow… Ungrateful.

That was quite a big hint, yrah.