mirror of
https://codeberg.org/scip/rpnc.git
synced 2025-12-17 12:31:04 +01:00
better switch
This commit is contained in:
4
calc.go
4
calc.go
@@ -370,9 +370,7 @@ func (c *Calc) EvalItem(item string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch item {
|
switch item {
|
||||||
case "?":
|
case "?", "help":
|
||||||
fallthrough
|
|
||||||
case "help":
|
|
||||||
c.PrintHelp()
|
c.PrintHelp()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -116,9 +116,7 @@ func (i *Interpreter) CallLuaFunc(funcname string, items []float64) (float64, er
|
|||||||
funcname, LuaFuncs[funcname].numargs))
|
funcname, LuaFuncs[funcname].numargs))
|
||||||
|
|
||||||
switch LuaFuncs[funcname].numargs {
|
switch LuaFuncs[funcname].numargs {
|
||||||
case 0:
|
case 0, 1:
|
||||||
fallthrough
|
|
||||||
case 1:
|
|
||||||
// 1 arg variant
|
// 1 arg variant
|
||||||
if err := LuaInterpreter.CallByParam(lua.P{
|
if err := LuaInterpreter.CallByParam(lua.P{
|
||||||
Fn: LuaInterpreter.GetGlobal(funcname),
|
Fn: LuaInterpreter.GetGlobal(funcname),
|
||||||
|
|||||||
Reference in New Issue
Block a user