Skip to content

Type warning when calling os.time with a table #2475

Open
@Caton27

Description

@Caton27

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Type Checking

Expected Behaviour

No warning

Actual Behaviour

The following warning is appearing:

Cannot assign string|osdate to parameter osdateparam?.

  • string cannot match osdateparam?
  • Type string cannot match nil
  • Type string cannot match osdateparam

Reproduction steps

  1. Enter the following code
local tDate = os.date("*t", os.time())
-- tDate is a table, e.g. {year=2024, month=1, day=10, hour=13, min=2, sec=24, yday=10, wday=4, isdst=false}
local newTime = os.time(tDate)
  1. Linter warning appears in the problems tab

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat/type checkRelated to the type checking feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions