Skip to content

Feature request: floor division operator // (Lua 5.3+) #335

Description

@timkrueger1993-lab

Summary

The floor division operator // (introduced in Lua 5.3, part of Lua 5.4) is rejected by the parser:

var state = LuaState.Create();
state.Load("local a = 7 // 2\nreturn a", "chunk");
// Lua.LuaParseException: chunk:1: unexpected symbol near '/'

Reproduced on 0.5.5 and 0.5.6.

I realize the README states Lua 5.2 as the implemented level, so strictly this is a feature request rather than a bug — filing it as the concrete, operator-level slice of #25 (Lua 5.3/5.4 support), since // is one of the two syntax-level gaps we actually hit in real application code (the other being the bitwise operators, filed separately).

Workaround

math.floor(a / b) — works, but scripts written against the Lua 5.4 reference fail to load with a message that does not hint at the version gap.

Context

We embed LuaCSharp as the scripting engine of a server runtime (Limes) whose applications are written against the Lua 5.4 manual; // was the first operator real application code tripped over. If there is interest in taking #25 forward, we would gladly test prereleases against our conformance suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions