Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 871

Bugs & Feature Suggestions • Rainmeter.exe crash with unrecognized format code for Lua os.date()

$
0
0
Rainmeter.exe crash with unrecognized format code for Lua os.date()

Example: os.date('%P')
%P does not exist as an os.date() format code.

I am trying to use some Date and Time format code for the Lua from
C++ time.h format code | https://learn.microsoft.com/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l
Since I could not find the full list of a format code for Lua 5.1.5 os.date().
Time measure Format Codes these format code works except # E O modifiers.

Minimum code to reproduce the issue.
Skin.ini

Code:

[Variables]$=1.00[Rainmeter]Update=1000[I]Measure=ScriptScriptFile=#@#Scripts\init.luaDisabled=1[Box]Meter=ImageW=(80*#$#)H=(80*#$#)SolidColor=EDEADELeftMouseUpAction=[!CommandMeasure I "test1()"]
@Resources\Scripts\init.lua

Code:

function test1()  --  -- These works.  --  -- print(os.date('%p'))  -- AM/PM  -- print(os.date('%e'))  -- Day of month  --  -- These does not work. It cause rainmeter.exe to crash.  --  print(os.date('%P'))      -- UPPERCASE of p  -- print(os.date('%#m'))  -- `%m` Month [01-12]. trying to remove leading zero.  -- print(os.date('%Ec'))  -- print(os.date('%1'))end---- function test2() does not work on the Rainmeter.-- Works on the online site https://onecompiler.com/lua/42m2jajfw--function test2()  local a = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'  local t, j, s, b, r = {}, 1  for i=1, #a do    s = '%'..a:sub(i,i)    b, r = pcall(os.date, s)    if b then      t[j] = s..'  '..r      j = j + 1    end  end  print(table.concat(t, '\n'))end
Rainmeter 4.5.21.3750 (64-bit)
Language: English (1033)
Build time: 2024-03-01 21:15:52
Windows 10 Pro 22H2 (build 19045.4651) 64-bit - Japanese (1041)
Path: C:\Apps\Rainmeter\
SkinPath: C:\Apps\Rainmeter\Skins\
SettingsPath: C:\Apps\Rainmeter\
IniFile: C:\Apps\Rainmeter\Rainmeter.ini

Removed all Rainmeter\Plugins\*.dll for testing.

Time measure Format Codes | https://docs.rainmeter.net/manual/measures/time/#FormatCodes
Working with date / time in Lua by jsmorley | https://forum.rainmeter.net/viewtopic.php?t=27625
Lua - os.date() | https://www.lua.org/manual/5.1/manual.html#pdf-os.date
Lua - Date and Time format code | https://www.lua.org/pil/22.1.html
C++ time.h format code | https://learn.microsoft.com/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l

Statistics: Posted by nek — Yesterday, 8:12 pm — Replies 2 — Views 104



Viewing all articles
Browse latest Browse all 871

Trending Articles