From 8d17ca0546e6d9e653ba8837fda42a1081164b7b Mon Sep 17 00:00:00 2001 From: "bill@Ixion" Date: Fri, 4 Sep 2009 01:36:26 -0500 Subject: [PATCH] Apparently we're not using love.filesystem.write anymore? Oh well. now file:write can write data as well. --- src/modules/filesystem/physfs/wrap_File.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modules/filesystem/physfs/wrap_File.cpp b/src/modules/filesystem/physfs/wrap_File.cpp index e07185011..c924c93d9 100644 --- a/src/modules/filesystem/physfs/wrap_File.cpp +++ b/src/modules/filesystem/physfs/wrap_File.cpp @@ -20,6 +20,7 @@ #include "wrap_File.h" +#include #include namespace love @@ -102,9 +103,19 @@ namespace physfs } } + else if( luax_istype(L, 2, DATA_T)) { + try + { + love::Data * data = luax_totype(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 { - return luaL_error(L, "String expected."); + return luaL_error(L, "String or data expected."); } lua_pushboolean(L, result); return 1;