mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Merge default branch.
--HG-- branch : minor
This commit is contained in:
@@ -348,6 +348,30 @@ int luax_convobj(lua_State *L, int idxs[], int n, const char *mod, const char *f
|
||||
return 0;
|
||||
}
|
||||
|
||||
int luax_pconvobj(lua_State *L, int idx, const char *mod, const char *fn)
|
||||
{
|
||||
// Convert string to a file.
|
||||
luax_getfunction(L, mod, fn);
|
||||
lua_pushvalue(L, idx); // The initial argument.
|
||||
int ret = lua_pcall(L, 1, 1, 0); // Call the function, one arg, one return value.
|
||||
if (ret == 0)
|
||||
lua_replace(L, idx); // Replace the initial argument with the new object.
|
||||
return ret;
|
||||
}
|
||||
|
||||
int luax_pconvobj(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.
|
||||
}
|
||||
int ret = lua_pcall(L, n, 1, 0); // Call the function, n args, one return value.
|
||||
if (ret == 0)
|
||||
lua_replace(L, idxs[0]); // Replace the initial argument with the new object.
|
||||
return ret;
|
||||
}
|
||||
|
||||
int luax_strtofile(lua_State *L, int idx)
|
||||
{
|
||||
return luax_convobj(L, idx, "filesystem", "newFile");
|
||||
|
||||
@@ -276,6 +276,10 @@ int luax_convobj(lua_State *L, int idx, const char *module, const char *function
|
||||
**/
|
||||
int luax_convobj(lua_State *L, int idxs[], int n, const char *module, const char *function);
|
||||
|
||||
// pcall versions of the above
|
||||
int luax_pconvobj(lua_State *L, int idx, const char *module, const char *function);
|
||||
int luax_pconvobj(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
|
||||
* table (k) is created if it does not exist in the table at idx. The table at idx must
|
||||
|
||||
@@ -44,7 +44,7 @@ int w_Data_getSize(lua_State *L)
|
||||
|
||||
const luaL_Reg w_Data_functions[] =
|
||||
{
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
// { "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user