seaofvoices / darklua

A command line tool that transforms Lua code
https://darklua.com/
MIT License
78 stars 10 forks source link

`inject_global_value` has weird behavior with very large number values #121

Closed osyrisrblx closed 10 months ago

osyrisrblx commented 1 year ago

I used the playground to test this.

My config is

{
  rules: [
    {
      rule: 'inject_global_value',
      identifier: '__DEV__',
      value: 1E10,
    },
  ],
}

My input Lua code is

print(__DEV__)

This creates an expected output of

print(1E10)

However, at higher values there's some weird behavior:

I'm sure there are more but I gave up.

Personally, I think the expected result would be that darklua would error if an input is unreasonably large.