Robin Withes 0 Posted November 1, 2017 I have to work alot of EXTB3 and me and one of the people i script with are stuck on this (possibly) simple issue. When we pulled a array out of the database that contains playeruids we noticed it was a string and not a array : _original = "[`76561197979553832`,`76561198128204387`,`76561198115523495`]"; Could anyone help us out here by turning it into preferrably: _original = [`76561197979553832`,`76561198128204387`,`76561198115523495`]; We've tried most stuff already including compiling it using toString etc, but nothing seems to work. Share this post Link to post Share on other sites
pierremgi 4836 Posted November 1, 2017 It seems to be not so easy! Test: _original = "[`76561197979553832`,`76561198128204387`,`76561198115523495`]"; parseSimpleArray ((_original splitString "'") joinString """"); 1 Share this post Link to post Share on other sites
Robin Withes 0 Posted November 1, 2017 Pasted your exact code and logged the _original var. Output is in the debug console. https://gyazo.com/d3fafeb11698f504ecdec2d05364eb39 1 Share this post Link to post Share on other sites
Robin Withes 0 Posted November 1, 2017 As soon as i parse the array it appears to f"ck up the numbers Example: "[76561197979553832,76561198128204387,76561198115523495]" [7.65612e+016,7.65612e+016,7.65612e+016] //after i parse it Share this post Link to post Share on other sites
gc8 977 Posted November 1, 2017 This code worked for me: it replaces the ` with ' and then compiles it. _original = "[`76561197979553832`,`76561198128204387`,`76561198115523495`]"; _new = ""; for "_i" from 0 to (count _original - 1) do { _c = _original select [_i,1]; if(_c == '`') then { _c = "'"; }; _new = _new + _c; }; _arr = call compile _new; player sidechat format["%1", _arr]; player sidechat format["%1", _arr select 0]; Share this post Link to post Share on other sites
Greenfist 1863 Posted November 1, 2017 Why not simply: _array = _original splitString "[`,]"; Which would result in an array of strings: ["76561197979553832","76561198128204387","76561198115523495"] Or are the ` characters necessary? 1 Share this post Link to post Share on other sites
pierremgi 4836 Posted November 1, 2017 2 hours ago, Robin Withes said: Pasted your exact code and logged the _original var. Output is in the debug console. https://gyazo.com/d3fafeb11698f504ecdec2d05364eb39 Please play attention on your entry. _arr = "[`76561197979553832`,`76561198128204387`,`76561198115523495`]"; is not the same as : _arr = "['76561197979553832','76561198128204387','76561198115523495']"; // apostrophe not the same as grave accent is not the same as : _arr = "[76561197979553832,76561198128204387,76561198115523495]"; // without any mark for this last entry, test: _arr splitString (tostring toarray "[,]") Share this post Link to post Share on other sites