nodemcu-firmware: String formatting: plus sign ignored for %+g

Expected behavior

My number has a plus sign, as on Ubuntu:

$ lua <<<'print(("%+g"):format(123), _VERSION)'
+123    Lua 5.2

Actual behavior

No sign in the REPL on my ESP8266 (using this firmware built with LUA=53 from current dev branch + tmr fix.

Test code

> print(("%+g"):format(123), _VERSION)
123     Lua 5.3

NodeMCU startup banner

NodeMCU 3.0.0.0 built with Docker provided by frightanic.com
        branch: lua53-dev
        commit: 9ff8d9f3e99b5c815b90cc40cb93b0102f80c2dd
        release: 3.0-master_20190907 +104
        release DTS: 202008311952
        SSL: false
        build type: float
        LFS: 0x10000 bytes total capacity
        modules: adc,bit,coap,color_utils,cron,crypto,encoder,file,gpio,gpio_pulse,http,i2c,mdns,mqtt,net,node,ow,pcm,perf,pipe,pwm,pwm2,rfswitch,rotary,rtcfifo,rtcmem,rtctime,sigma_delta,sjson,sntp,spi,struct,tls,tmr,uart,websocket,wifi,wifi_monitor
 build 2020-08-31 19:55 powered by Lua 5.3.5 on SDK 3.0.1-dev(fce080e)
cannot open init.lua: 

Hardware

ESP8266 LoLin v3

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Thanks for testing. I’ll try to have a look at both issues. If there’s easy way to fix it it can be done. Maybe we should continue the discussion directly in the PR.

@mk-pmb Can you please check the fix in the PR #3270?