You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to change from a C runtime to a JS runtime, and am running into issues with the int32 type. Lua code which I can't modify is concatenating "33 bit" numbers (>= 2^31) to strings. Lua correctly internally represents these as floats, but somewhat annoyingly stringifies them with a trailing .0 when concatenating. This is annoying because it causes differences in output compared to the C Lua that I was previously using as the runtime. So I was trying to solve this, and was curious if there might be some way to change how numbers get stringified. Can I somehow modify this behavior, so that for large floats lua drops the trailing .0 if there is no fractional part? I'd like to do this without having to modify my existing code (except for maybe modifying _G or simmilar before my code runs) in any way. That means solutions like wrapping numeric values with string.format('%.0f', foo) unfourtunately don't work for my use case.
Javascript BigInts (#128) might work when implemented, but I'm looking for an immediate solution if available.
I am trying to change from a C runtime to a JS runtime, and am running into issues with the int32 type. Lua code which I can't modify is concatenating "33 bit" numbers (
>= 2^31
) to strings. Lua correctly internally represents these as floats, but somewhat annoyingly stringifies them with a trailing.0
when concatenating. This is annoying because it causes differences in output compared to the C Lua that I was previously using as the runtime. So I was trying to solve this, and was curious if there might be some way to change how numbers get stringified. Can I somehow modify this behavior, so that for large floats lua drops the trailing.0
if there is no fractional part? I'd like to do this without having to modify my existing code (except for maybe modifying_G
or simmilar before my code runs) in any way. That means solutions like wrapping numeric values withstring.format('%.0f', foo)
unfourtunately don't work for my use case.Javascript BigInts (#128) might work when implemented, but I'm looking for an immediate solution if available.
For more context, see here on stack overflow
The text was updated successfully, but these errors were encountered: