comparison src/modules/image/wrap_ImageData.cpp @ 1418:357697c2e2a8

More internal code cleanup
author Alex Szpakowski <slime73@gmail.com>
date Sun, 31 Mar 2013 19:02:27 -0300
parents d9d550a73ebf
children 5b9ebe6a9a7e
comparison
equal deleted inserted replaced
1417:c70c9e4d10f3 1418:357697c2e2a8
165 165
166 if (lua_isnoneornil(L, 3)) 166 if (lua_isnoneornil(L, 3))
167 { 167 {
168 ext = file->getExtension(); 168 ext = file->getExtension();
169 fmt = ext.c_str(); 169 fmt = ext.c_str();
170 ImageData::getConstant(fmt, format); 170 if (!ImageData::getConstant(fmt, format))
171 return luaL_error(L, "Invalid image format '%s'.", fmt);
171 } 172 }
172 else 173 else
173 { 174 {
174 fmt = luaL_checkstring(L, 3); 175 fmt = luaL_checkstring(L, 3);
175 if (!ImageData::getConstant(fmt, format)) 176 if (!ImageData::getConstant(fmt, format))
176 luaL_error(L, "Invalid image format."); 177 return luaL_error(L, "Invalid image format '%s'.", fmt);
177 } 178 }
178 179
179 try 180 try
180 { 181 {
181 t->encode(file, format); 182 t->encode(file, format);
187 return 0; 188 return 0;
188 } 189 }
189 190
190 static const luaL_Reg functions[] = 191 static const luaL_Reg functions[] =
191 { 192 {
192
193 // Data 193 // Data
194 { "getPointer", w_Data_getPointer }, 194 { "getPointer", w_Data_getPointer },
195 { "getSize", w_Data_getSize }, 195 { "getSize", w_Data_getSize },
196 196
197 { "getWidth", w_ImageData_getWidth }, 197 { "getWidth", w_ImageData_getWidth },