{{newin|[[11.0]]|110|type=function}}

Encode Data or a string to a Data or string in one of the [[EncodeFormat|EncodeFormats]].
 
== Function ==
=== Synopsis ===
<source lang="lua">
encoded = love.data.encode( container, format, sourceString, linelength )
</source>
=== Arguments ===
{{param|ContainerType|container|What type to return the encoded data as.}}
{{param|EncodeFormat|format|The format of the output data.}}
{{param|string|sourceString|The raw data to encode.}}
{{param|number|linelength (0)|The maximum line length of the output. Only supported for base64, ignored if 0.}}
=== Returns ===
{{param|value|encoded|[[ByteData]]/[[string]] which contains the encoded version of source.}}

== Function ==
=== Synopsis ===
<source lang="lua">
encoded = love.data.encode( container, format, sourceData, linelength )
</source>
=== Arguments ===
{{param|ContainerType|container|What type to return the encoded data as.}}
{{param|EncodeFormat|format|The format of the output data.}}
{{param|Data|sourceData|The raw data to encode.}}
{{param|number|linelength (0)|The maximum line length of the output. Only supported for base64, ignored if 0.}}
=== Returns ===
{{param|value|encoded|[[ByteData]]/[[string]] which contains the encoded version of source.}}

== See Also ==
* [[parent::love.data]]
* [[love.data.decode]]
[[Category:Functions]]
{{#set:Description=Encode Data or a string to a Data or string in one of the [[EncodeFormat|EncodeFormats]].}}
== Other Languages ==
{{i18n|love.data.encode}}