Clue icon indicating copy to clipboard operation
Clue copied to clipboard

Make parentheses optional for function calls with single parameter string/table

Open Lyrth opened this issue 1 year ago • 1 comments

Lua supports function calls without parentheses for specific kinds of literals:

-- equivalent to my_func("str")
local a = my_func "str"

-- equivalent to other_func({1, 2})
local b = other_func {1, 2}

Clue could support no-parentheses string calls just fine, and could probably make it work with special strings too (like raw). Although, the table param call will be problematic since code blocks also use { }.

On the other hand, method calls (class::method()) could support single table params as the call can't be confused with a expression + block combination. Slightly useful for class-related structures:

local p = Vec3::new { -4, 2.2, 0 }

Lyrth avatar Nov 29 '23 16:11 Lyrth