lua_call¶
lua_call ruft eine Lua-Funktion auf.
-
ret = lua_call(function, par1, ...)
-
<r1, r2, ...> = lua_call(function, par1, ...)
Returnwert
ret ist eine Zahl (64-Bit double) oder ein Lua-Value.
LUA_TNIL |
LUA_TBOOLEAN |
LUA_TLIGHTUSERDATA |
LUA_TSTRING |
LUA_TTABLE |
LUA_TFUNCTION |
LUA_TUSERDATA |
LUA_TTHREAD |
Parameter
-
function
function
-
par1
par1
-
...
…
Beispiel
sin-Funktion der Lua-math-Library aufrufen:
lmath = lua_require("math")
lsin = lua_get(lmath, "sin")
lua_call(lsin, 1)
0.8415
Die lua_require und lua_get-Funktionen verwenden auch die lua_call-Funktion.
def lua_require(s)
{
return lua_call("require", s)
}
def lua_get(table, index)
{
return lua_call("rawget", table, index);
}
History
Version | Beschreibung |
---|---|
R2016 | Neu. |
Siehe auch
Überblick Lua, Lua, lua_string, lua_require, lua_get, lua_eval, lua_type
id-1323776