RaphaelIT7 / gmod-holylib

A library that contains some functions and optimizations for gmod.
46 stars 4 forks source link

TableToJSON that actually respects things like integers. #6

Closed NathanX-S closed 1 month ago

RaphaelIT7 commented 2 months ago

I'll look into it tomorrow :D

RaphaelIT7 commented 2 months ago

So just for tomorrow, you mean with respects integers that it stops to convert it to a decimal?

NathanX-S commented 2 months ago

Yup! More accurate/friendly conversions, especially for things like APIs.

RaphaelIT7 commented 2 months ago

Does it only happen with integers or are there also other cases? (Could imagine that since LUA->GetNumber returns a double that they just make it a decimal without checking if it is an Integer / has any decimals)

RaphaelIT7 commented 1 month ago

I now check if the number has no decimals and also check if it's in the integer range/limits. If it is, it will be made into one. I also noticed, it seems like my TableToJSON function is faster than gmods xd

Anyways, I'll test it a bit more and document it if I haven't yet.

RaphaelIT7 commented 1 month ago

Should be done now. It should now also behave the same as Gmod's version (And it's still faster :D)