diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-02 20:04:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-02 20:04:12 -0300 |
commit | 075b7918c3dcc1e8b4d5e7f19ae213b081e01bf2 (patch) | |
tree | ae1dd456984f4e7128b2d4a2e2e43e4f23b99d01 /iolib.c | |
parent | 7c99149a76ce0c7469c9bafec5dfff529f88512c (diff) | |
download | lua-075b7918c3dcc1e8b4d5e7f19ae213b081e01bf2.tar.gz lua-075b7918c3dcc1e8b4d5e7f19ae213b081e01bf2.tar.bz2 lua-075b7918c3dcc1e8b4d5e7f19ae213b081e01bf2.zip |
new function "getintmethod"
Diffstat (limited to 'iolib.c')
-rw-r--r-- | iolib.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -288,9 +288,10 @@ static void getbyte (void) | |||
288 | lua_pushnumber(lua_getbindatasize(ud)); | 288 | lua_pushnumber(lua_getbindatasize(ud)); |
289 | else { | 289 | else { |
290 | i--; | 290 | i--; |
291 | luaL_arg_check(0 <= i && i < lua_getbindatasize(ud), "getbyte", 2, | 291 | if (0 <= i && i < lua_getbindatasize(ud)) |
292 | "out of range"); | 292 | lua_pushnumber(*(((char *)lua_getbinarydata(ud))+i)); |
293 | lua_pushnumber(*(((char *)lua_getbinarydata(ud))+i)); | 293 | else |
294 | lua_pushnil(); | ||
294 | } | 295 | } |
295 | } | 296 | } |
296 | 297 | ||
@@ -341,7 +342,7 @@ static struct luaL_reg iolib[] = { | |||
341 | 342 | ||
342 | void iolib_open (void) | 343 | void iolib_open (void) |
343 | { | 344 | { |
344 | lua_tagio = lua_newtag("userdata"); | 345 | lua_tagio = lua_newtag(); |
345 | lua_infile=stdin; lua_outfile=stdout; | 346 | lua_infile=stdin; lua_outfile=stdout; |
346 | luaL_openlib(iolib, (sizeof(iolib)/sizeof(iolib[0]))); | 347 | luaL_openlib(iolib, (sizeof(iolib)/sizeof(iolib[0]))); |
347 | lua_seterrormethod(errorfb); | 348 | lua_seterrormethod(errorfb); |