luad.conversions.functions

Internal module for pushing and getting functions and delegates.

LuaD allows for pushing of all D function or delegate types with return type and parameter types compatible with LuaD (see $(DPMODULE stack)).

For a fixed number of multiple return values, return a $(STDREF typecons,Tuple) or a static array. For a variable number of return values, return LuaVariableReturn.

As a special case for const(char)[] parameter types in functions pushed to Lua, no copy of the string is made when called; take care not to escape such references, they are effectively scope parameters. When a copy is desired, use char[] or string, or dup or idup the string manually.

If a function with the lua_CFunction signature is encountered, it is pushed directly with no inserted conversions or overhead.

Typesafe varargs is supported when pushing functions to Lua, but as of DMD 2.054, compiler bugs prevent getting delegates with varargs from Lua (use $(DPREF lfunction,LuaFunction) instead).

Public Imports

luad.testing
public import luad.testing;
std.typecons
public import std.typecons;
luad.base
public import luad.base;

Members

Functions

callFunction
int callFunction(lua_State* L, T func, ParameterTypeTuple!T args)
Undocumented in source. Be warned that the author may not have intended to support it.
callFunction
int callFunction(lua_State* L, T func, ParameterTypeTuple!T args)
Undocumented in source. Be warned that the author may not have intended to support it.
getFunction
T getFunction(lua_State* L, int idx)

Currently this function allocates a reference in the registry that is never deleted, one for each call... see code comments

pushFunction
void pushFunction(lua_State* L, T func)
Undocumented in source. Be warned that the author may not have intended to support it.
pushMethod
void pushMethod(lua_State* L)
Undocumented in source. Be warned that the author may not have intended to support it.
variableReturn
LuaVariableReturn!Range variableReturn(Range returnValues)

Create a LuaVariableReturn object for efficiently returning a variable number of values from a function.

Structs

LuaVariableReturn
struct LuaVariableReturn(Range)

Type for efficiently returning a variable number of return values from a function.

Templates

BindableReturnType
template BindableReturnType(T)
Undocumented in source.
FillableParameterTypeTuple
template FillableParameterTypeTuple(T)
Undocumented in source.
StripHeadQual
template StripHeadQual(T : const(T*))
Undocumented in source.
StripHeadQual
template StripHeadQual(T : const(T[]))
Undocumented in source.
StripHeadQual
template StripHeadQual(T : immutable(T*))
Undocumented in source.
StripHeadQual
template StripHeadQual(T : immutable(T[]))
Undocumented in source.
StripHeadQual
template StripHeadQual(T : T[])
Undocumented in source.
StripHeadQual
template StripHeadQual(T : T*)
Undocumented in source.
StripHeadQual
template StripHeadQual(T : T[N], size_t N)
Undocumented in source.
StripHeadQual
template StripHeadQual(T)
Undocumented in source.

Meta