Skip to content

Commit e5dfad1

Browse files
author
Thomas von Dein
committed
better switch
1 parent 43fcf43 commit e5dfad1

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

calc.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,7 @@ func (c *Calc) EvalItem(item string) error {
370370
}
371371

372372
switch item {
373-
case "?":
374-
fallthrough
375-
case "help":
373+
case "?", "help":
376374
c.PrintHelp()
377375

378376
default:

interpreter.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ func (i *Interpreter) CallLuaFunc(funcname string, items []float64) (float64, er
116116
funcname, LuaFuncs[funcname].numargs))
117117

118118
switch LuaFuncs[funcname].numargs {
119-
case 0:
120-
fallthrough
121-
case 1:
119+
case 0, 1:
122120
// 1 arg variant
123121
if err := LuaInterpreter.CallByParam(lua.P{
124122
Fn: LuaInterpreter.GetGlobal(funcname),

0 commit comments

Comments
 (0)