-
Notifications
You must be signed in to change notification settings - Fork 690
Closed
Description
You must post issues only here. Questions, ideas must be posted in discussions.
- GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
- GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.
Please answer the following before submitting your issue:
- What version of GopherLua are you using? : 2b3f02d
- What version of Go are you using? :
go version go1.19.12 linux/amd64 - What operating system and processor architecture are you using? : See 2.
- What did you do? :
- What did you expect to see? :
xpcallwith error in error handler returns(false, error-object).
/ # lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> ok, msg = xpcall(function() error("fn") end, function(err) error("handler") end)
> print(ok, msg)
false error in error handling
> function test()
>> xpcall(function() error("fn") end, function(err) error("handler") end)
>> error("expected to reach this")
>> end
> test()
stdin:3: expected to reach this
stack traceback:
[C]: in function 'error'
stdin:3: in function 'test'
stdin:1: in main chunk
[C]: ?
>- What did you see instead? :
xpcallwith error in error handler returns(nil, nil).
In addition,xpcallexits current function scope and interpreter does not execute next line.
/workspaces/gopher-lua/cmd/glua# ./glua
GopherLua 0.1 Copyright (C) 2015 -2017 Yusuke Inuzuka
> ok, msg = xpcall(function() error("fn") end, function(err) error("handler") end)
> print(ok, msg)
nil nil
> function test()
>> xpcall(function() error("fn") end, function(err) error("handler") end)
>> error("expected to reach this")
>> end
> test()
> Although the behavior of xpcall with error in error handler is not well described in the reference, but it is better to be compatible with CLua5.1 behavior.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels