Table.fromString

From Multi Theft Auto: Wiki
Revision as of 17:44, 24 August 2021 by Tracer (talk | contribs) (Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ This function converts string to a table.<br/> <span style='color:#AA0000'>If '''str''' is not a table, this fu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function converts string to a table.
If str is not a table, this function will throw an error.

Syntax

string table.fromString( string str )

Required Arguments

  • str: The string to convert.

Returns

Returns table if string was successfully converted, false otherwise.

Click to collapse [-]
Shared function
function table.fromString(str)
    if type(str) ~= 'string' then return false end
    return (loadstring)('return '..str)()
end

Author: Tracer

See Also