Gothic Online Forums
Table to string - Printable Version

+- Gothic Online Forums (https://archive.gothic-online.com)
+-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html)
+--- Forum: Scripting Help (https://archive.gothic-online.com/forum-12.html)
+--- Thread: Table to string (/thread-1426.html)



Table to string - WiteXDan - 23.04.2016

Hi.
How I'm able to convert a table into string, for print purposes.

For example 
local position = getCursorPosition();
[...]
print(position);


RE: Table to string - Ignisio - 23.04.2016

print ("X: "+position.x+" "+"Y "+position.y);

[Image: 5483370700_1461400500.png]


RE: Table to string - WiteXDan - 23.04.2016

So... is the converting possible? Big Grin I know this way, but a convert will be more useful for me.


RE: Table to string - KimiorV - 23.04.2016

local pos = getCursorPosition();
print(pos.x + " " + pos.y);

No more options


RE: Table to string - Ignisio - 23.04.2016

Convert? For draws?


local position = getCursorPosition();
local posx= position.x.tostring();
local posy= position.y.tostring();
(tointeger(), tochar() ....)
print(posx +" "+ posy);


RE: Table to string - HammelGammel - 23.04.2016

I think this isn't what he is looking for. There are times when you need your table as a string, for saving it to a file for example while keeping the file readable. You can write your own method for this, I don't think Squirrel has one you can use. That being said, I have posted something for you over here: http://gothic-online.com.pl/forum/showthread.php?tid=1427

The converted strings look like this and can be converted back: {y{5090.97}x{47532.7}z{20632.1}angle{333.455}}
Hopefully that's what you are searching for.