diff --git a/includes/engines/LuaCommon/LuaInterpreter.php b/includes/engines/LuaCommon/LuaInterpreter.php index 846c658f..14f3fd50 100644 --- a/includes/engines/LuaCommon/LuaInterpreter.php +++ b/includes/engines/LuaCommon/LuaInterpreter.php @@ -16,8 +16,9 @@ abstract class Scribunto_LuaInterpreter { * at zero. If an error occurs, a Scribunto_LuaError will be thrown. * * @param mixed $func The function object + * @param mixed ...$args Arguments to the function */ - abstract public function callFunction( $func /*...*/ ); + abstract public function callFunction( $func, ...$args ); /** * Wrap a PHP callable as a Lua function, which can be passed back into diff --git a/includes/engines/LuaSandbox/Engine.php b/includes/engines/LuaSandbox/Engine.php index ec323d11..bb49c058 100644 --- a/includes/engines/LuaSandbox/Engine.php +++ b/includes/engines/LuaSandbox/Engine.php @@ -309,9 +309,7 @@ class Scribunto_LuaSandboxInterpreter extends Scribunto_LuaInterpreter { # $name, [ $this, 'callback' ], $functions ); } - public function callFunction( $func /*, ... */ ) { - $args = func_get_args(); - $func = array_shift( $args ); + public function callFunction( $func, ...$args ) { try { $ret = $func->call( ...$args ); if ( $ret === false ) { diff --git a/includes/engines/LuaStandalone/LuaStandaloneEngine.php b/includes/engines/LuaStandalone/LuaStandaloneEngine.php index 765312fb..7295aa76 100644 --- a/includes/engines/LuaStandalone/LuaStandaloneEngine.php +++ b/includes/engines/LuaStandalone/LuaStandaloneEngine.php @@ -354,7 +354,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter { return new Scribunto_LuaStandaloneInterpreterFunction( $this->id, $result[1] ); } - public function callFunction( $func /* ... */ ) { + public function callFunction( $func, ...$args ) { if ( !( $func instanceof Scribunto_LuaStandaloneInterpreterFunction ) ) { throw new MWException( __METHOD__ . ': invalid function type' ); }