diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:11:07 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:11:07 -0300 |
commit | 0079e0f57ce2bd4dc40b9b7c5831c58764a7938f (patch) | |
tree | fbef733822b5448991097a059afc9c544b7a1bc7 /lapi.c | |
parent | cfff0135868969de015e5cdcbd50ae7ae3ecc92d (diff) | |
download | lua-0079e0f57ce2bd4dc40b9b7c5831c58764a7938f.tar.gz lua-0079e0f57ce2bd4dc40b9b7c5831c58764a7938f.tar.bz2 lua-0079e0f57ce2bd4dc40b9b7c5831c58764a7938f.zip |
core tests whether file is binary
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.193 2002/05/27 20:35:40 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.194 2002/06/03 17:46:34 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -564,13 +564,15 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errf) { | |||
564 | 564 | ||
565 | 565 | ||
566 | LUA_API int lua_load (lua_State *L, lua_Getblock getblock, void *ud, | 566 | LUA_API int lua_load (lua_State *L, lua_Getblock getblock, void *ud, |
567 | int binary, const char *chunkname) { | 567 | const char *chunkname) { |
568 | ZIO z; | 568 | ZIO z; |
569 | int status; | 569 | int status; |
570 | int c; | ||
570 | lua_lock(L); | 571 | lua_lock(L); |
571 | if (!chunkname) chunkname = "?"; | 572 | if (!chunkname) chunkname = "?"; |
572 | luaZ_init(&z, getblock, ud, chunkname); | 573 | luaZ_init(&z, getblock, ud, chunkname); |
573 | status = luaD_protectedparser(L, &z, binary); | 574 | c = luaZ_lookahead(&z); |
575 | status = luaD_protectedparser(L, &z, (c == LUA_SIGNATURE[0])); | ||
574 | lua_unlock(L); | 576 | lua_unlock(L); |
575 | return status; | 577 | return status; |
576 | } | 578 | } |