Skip to content

String formatting: plus sign ignored for %+g #3265

@mk-pmb

Description

@mk-pmb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions