Merge default branch.

--HG--
branch : minor
This commit is contained in:
rude
2013-01-12 11:52:04 +01:00
9 changed files with 347 additions and 118 deletions
+24
View File
@@ -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");
+4
View File
@@ -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
+1 -1
View File
@@ -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 }
};