.. highlightlang:: us .. index:: lua_call .. _lua_call: lua_call ======== .. us.tag lua_call NOTREADYENGLISH Lua New5800 :ref:`lua_call` calls a Lua function. .. function:: ret = lua_call(function, par1, ...) = lua_call(function, par1, ...) .. us.return **Return Value** *ret* is a number (64 bit double) or a Lua value. .. list-table:: :header-rows: 0 * - LUA_TNIL * - LUA_TBOOLEAN * - LUA_TLIGHTUSERDATA * - LUA_TSTRING * - LUA_TTABLE * - LUA_TFUNCTION * - LUA_TUSERDATA * - LUA_TTHREAD .. us.params **Parameters** .. uparam:: function *function* .. uparam:: par1 *par1* .. uparam:: ... *...* .. us.example **Example** Invoke **sin** function from the Lua math library: :: lmath = lua_require("math") lsin = lua_get(lmath, "sin") lua_call(lsin, 1) 0.8415 The :ref:`lua_require` and :ref:`lua_get` function uses :ref:`lua_call`. :: def lua_require(s) { return lua_call("require", s) } def lua_get(table, index) { return lua_call("rawget", table, index); } .. us.example **Beispiel** **sin**-Funktion der Lua-math-Library aufrufen: :: lmath = lua_require("math") lsin = lua_get(lmath, "sin") lua_call(lsin, 1) 0.8415 Die :ref:`lua_require` und :ref:`lua_get`-Funktionen verwenden auch die :ref:`lua_call`-Funktion. :: def lua_require(s) { return lua_call("require", s) } def lua_get(table, index) { return lua_call("rawget", table, index); } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2016.0 - New. .. seealso:: :ref:`overview-lua`, :ref:`lua`, :ref:`lua_string`, :ref:`lua_require`, :ref:`lua_get`, :ref:`lua_eval`, :ref:`lua_type` :sub:`id-1323776`