Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust

Home Page:https://kampfkarren.github.io/selene/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding/improving Lua standards

nvs opened this issue · comments

The standards provided by selene have some deprecated features (e.g. unpack in Lua 5.3) and other inconsistencies present. It might be best to adhere to Lua's default compilation flags, as most users will encounter versions of Lua using those. For reference:

Version Default Flags
Lua 5.1 See luaconf.h
Lua 5.2 LUA_COMPAT_ALL
Lua 5.3 LUA_COMPAT_5_2
Lua 5.4 LUA_COMPAT_5_3

One would need to consult 'luaconf.h' for various details. However, a good example is unpack, while considering the default flags.

  • Lua 5.1: Exists.
  • Lua 5.2: Deprecated. But not in selene. Lua suggests using table.unpack.
  • Lua 5.3: Does not exist. But does in selene. Would need LUA_COMPAT_5_1, which is not active by default.
  • Lua 5.4: Does not exist. Not supported by selene yet.

Luacheck provides the following standards, to cover various use cases.

  • lua51: Lua 5.1 without deprecated features.
  • lua51c: Lua 5.1
  • lua52: Lua 5.2
  • lua52c: Lua 5.2 with LUA_COMPAT_ALL
  • lua53: Lua 5.3
  • lua53c: Lua 5.3 with LUA_COMPAT_5_2
  • lua54: Lua 5.4
  • lua54c: Lua 5.4 with LUA_COMPAT_5_3

Would it make sense for selene to do something similar? Probably just the standards with the default configurations are enough. I also noticed #154, which is related to adding LuaJIT standard.

Any inconsistencies you see are a result of me being firmly in the world of Roblox, which uses a derivative of 5.1 :)

Any contribution like this would be appreciated.