mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Apparently we're not using love.filesystem.write anymore? Oh well. now file:write can write data as well.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "wrap_File.h"
|
#include "wrap_File.h"
|
||||||
|
|
||||||
|
#include <common/Data.h>
|
||||||
#include <common/Exception.h>
|
#include <common/Exception.h>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
@@ -102,9 +103,19 @@ namespace physfs
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if( luax_istype(L, 2, DATA_T)) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
love::Data * data = luax_totype<love::Data>(L, 2, "Data", DATA_T);
|
||||||
|
result = file->write(data, luaL_optint(L, 3, data->getSize()));
|
||||||
|
} catch(Exception e)
|
||||||
|
{
|
||||||
|
return luaL_error(L, e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return luaL_error(L, "String expected.");
|
return luaL_error(L, "String or data expected.");
|
||||||
}
|
}
|
||||||
lua_pushboolean(L, result);
|
lua_pushboolean(L, result);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user