mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
added varargs version of luax_convobj (for making Rasterizers)
This commit is contained in:
@@ -267,6 +267,17 @@ namespace love
|
||||
lua_replace(L, idx); // Replace the initial argument with the new object.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int luax_convobj(lua_State * L, int idxs[], int n, const char * mod, const char * fn)
|
||||
{
|
||||
luax_getfunction(L, mod, fn);
|
||||
for (int i = 0; i < n; i++) {
|
||||
lua_pushvalue(L, idxs[i]); // The arguments.
|
||||
}
|
||||
lua_call(L, n, 1); // Call the function, n args, one return value.
|
||||
lua_replace(L, idxs[0]); // Replace the initial argument with the new object.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int luax_strtofile(lua_State * L, int idx)
|
||||
{
|
||||
|
||||
+16
-1
@@ -209,7 +209,7 @@ namespace love
|
||||
/**
|
||||
* Converts an object into another object by the specified function love.module.function.
|
||||
* The conversion function must accept a single object of the relevant type as a parameter,
|
||||
* and returnone value. If the function does not exist (see luax_getfunction), an error is returned.
|
||||
* and return one value. If the function does not exist (see luax_getfunction), an error is returned.
|
||||
*
|
||||
* Note that the initial object at idx is replaced by the new object.
|
||||
*
|
||||
@@ -219,6 +219,21 @@ namespace love
|
||||
* @param function The function in the module.
|
||||
**/
|
||||
int luax_convobj(lua_State * L, int idx, const char * module, const char * function);
|
||||
|
||||
/**
|
||||
* Converts an object into another object by the specified function love.module.function.
|
||||
* The conversion function must accept a single object of the relevant type as its first parameter,
|
||||
* and return one value. If the function does not exist (see luax_getfunction), an error is returned.
|
||||
*
|
||||
* Note that the initial object at idx is replaced by the new object.
|
||||
*
|
||||
* @param L The Lua state.
|
||||
* @param idxs An array of indices on the stack.
|
||||
* @param n How many arguments are being passed.
|
||||
* @param module The module in the love table.
|
||||
* @param function The function in the module.
|
||||
**/
|
||||
int luax_convobj(lua_State * L, int idxs[], int n, const char * module, const char * function);
|
||||
|
||||
/**
|
||||
* 'Insist' that a table 'k' exists in the table at idx. Insistence involves that the
|
||||
|
||||
Reference in New Issue
Block a user