Type casing in Lua?

For those who don’t know what that means, I’m trying to change a string to a number. Let me explain the background:

I’m currently trying to make a nodegraph creation script to use with pathfinding, so I can make enemies weave inbetween mazes of towers, as I’m doing this with Gmod TD in mind, because I’d prefer gameplay that way.

To avoid having to create the node graph each time, link it, then filter it, especially since all of it can’t be done autonomously, I’m trying to make it so that it saves and then loads the node graph, so all that is left to do is link (I’m using util.TableToKeyValues, so trying to keep the links would crash, since the tables contain each other).

I’ve gotten most of it to work. However, when I loaded the positions, they all turned out as “1”. I think this is due to the fact that it saves it as a string, then tries to load it as a number, because it is then placed inside a vector. So, is there any way to fix this?

No, it’s the saving function.

util.TableToKeyValues and the reverse “sanitize” the keys and do strange things with them.

You might be better off using glon.

What does your node structure look like?

				"Y"		"-3"
				"x"		"-2"
				"Y"		"-1709.4688720703"
				"x"		"86.596794128418"
				"Z"		"-63.968799591064"

I solved it anyways. it turns out util.KeyValuesToTable was taking all the variables and turning them into lowercase. So it created some sort of case sensitive error. The details on that, I don’t know.

But I did manage to solve it myself with a little screwing around. I thank table.ToString for debugging. :v:


And thanks for your help, Kogitsune. I may try glon later as well, in order to save some space.