summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/liolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/liolib.c')
-rw-r--r--apps/plugins/lua/liolib.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/apps/plugins/lua/liolib.c b/apps/plugins/lua/liolib.c
index eea40c0d02..e50524ae89 100644
--- a/apps/plugins/lua/liolib.c
+++ b/apps/plugins/lua/liolib.c
@@ -245,24 +245,13 @@ static int io_lines (lua_State *L) {
245** ======================================================= 245** =======================================================
246*/ 246*/
247 247
248
249static int read_number (lua_State *L, int *f) { 248static int read_number (lua_State *L, int *f) {
250 char buf[10]; /* Maximum uint32 value is 10 chars long */
251 lua_Number d; 249 lua_Number d;
252 int i = 0; 250 if (PREFIX(fscanf)(*f, LUA_NUMBER_SCAN, &d) == 1) {
253 /* Rather hackish, but we don't have fscanf.
254 Was: fscanf(f, LUA_NUMBER_SCAN, &d); */
255 memset(buf, 0, 10);
256 rb->read(*f, buf, 10);
257 while(isdigit(buf[i]) && i < 10)
258 i++;
259 if(i == 0) return 0;
260 else {
261 rb->lseek(*f, i-10, SEEK_CUR);
262 d = rb->atoi(buf);
263 lua_pushnumber(L, d); 251 lua_pushnumber(L, d);
264 return 1; 252 return 1;
265 } 253 }
254 else return 0; /* read fails */
266} 255}
267 256
268 257