util.TableToKeyValues broken?

Alright, so i have an entity. I want to save its position, and angle when someone presses ‘e’ on it. Here is my code

[lua]
function ENT:Use()

MOTD_Data = {}
MOTD_Data.Pos = self.Entity:GetPos()
MOTD_Data.Ang = self.Entity:GetAngles() 
MOTD_String = util.TableToKeyValues( MOD_Data )

file.Write( "MOTD3D/Mapdata/"..game.GetMap()..".txt", MOTD_String )
print( "MOTD Savedata:" )
print( "	Map: "..game.GetMap() )
print( "	Pos: "..tostring( self:GetPos() ) )
print( "	Ang: "..tostring( self:GetAngles() ) )

end
[/lua]

Now, i get <mapename>.txt in MOTD3D/Mapdata/.
BUT, this is what ends up inside it



"Out"
{
}


I know util.TableToKeyValues IS working somewhat, otherwise i wouldn’t have got that in the file. Perhaps it doesn’t like my table? Maybe util.TableToKeyValues is broken? Maybe i am missing a stupidly obvious error?

What do you guys think?


] lua_run print(util.TableToKeyValues{Vector(),Angle(),"Test",1234})
> print(util.TableToKeyValues{Vector(),Angle(),"Test",1234})...
"Out"
{
	"3"		"Test"
	"4"		"1234"
}

util.TableToKeyValues() can’t encode userdata.
Use GLON.

Oh, duh.

GLON is a bit of an overkill in this situation. I just need something simple. Thanks anyway, i have an idea.

Descriptions on the wiki.

Works a charm. Thanks guys :slight_smile: