Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows %R is not a valid format specifier for os.date #352

Closed
MasonGulu opened this issue Mar 29, 2024 · 2 comments
Closed

On Windows %R is not a valid format specifier for os.date #352

MasonGulu opened this issue Mar 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MasonGulu
Copy link

Describe the bug
This is a platform specific issue. On Linux calling os.date("%R") results in the correct formatting. On Windows calling the same snippet results in an error.

To Reproduce
Steps to reproduce the behavior:

  1. Open lua prompt
  2. Type in os.date("%R")
  3. Compare behavior on Linux vs. Windows.

Expected behavior
No Crash.

Screenshots
image

Environment (please complete the following information):

  • OS: Windows 10 / Kubuntu 22.04
  • CraftOS-PC Version: 2.8.1
  • Compiled from source? No

Additional context
Add any other context about the problem here.

@MasonGulu MasonGulu added the bug Something isn't working label Mar 29, 2024
@MasonGulu
Copy link
Author

minerobber pointed out this relevant code
https://github.com/MCJack123/craftos2-lua/blob/lua-5.2/src/loslib.c#L28-L35

@MineRobber9000
Copy link

Specifically, if LUA_USE_POSIX is not defined, Lua restricts itself to a set of format specifiers that it knows will be available (%R is a C99 addition according to Jack so on a C89 system it wouldn't be available). Since Windows is not POSIX, %R isn't in the list of allowed format specifiers, and Lua responds with an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants