Skip to content

Issue #551 : Accept callable tables as the first argument of xpcall - #552

Open
XinyuGuan wants to merge 1 commit into
yuin:masterfrom
XinyuGuan:xpcall-callable
Open

XinyuGuan wants to merge 1 commit into
yuin:masterfrom
XinyuGuan:xpcall-callable

Conversation

@XinyuGuan

Copy link
Copy Markdown

Fixes #551.

baseXPCall now uses L.CheckAny(1) instead of L.CheckFunction(1), allowing callable tables to reach the existing protected-call machinery. pcall already supports callable tables following #328.

Extra arguments remain ignored, preserving Lua 5.1 behavior. A supplied non-callable first argument now returns false plus the error handler's result instead of raising an argument-check error, matching Lua 5.1.5's control flow. Diagnostic text may differ.

The regression test in _glua-tests/issues.lua covers callable-table success and error handling.

Validation:

  • make build
  • go test -count=1 ./
  • git diff --check

Related: #467 also removes this check as part of a broader argument-forwarding change. This PR isolates the callable-value fix while keeping the current behavior of not forwarding extra arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xpcall rejects callable tables as its first argument

1 participant