aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-03 17:11:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-03 17:11:07 -0300
commit0079e0f57ce2bd4dc40b9b7c5831c58764a7938f (patch)
treefbef733822b5448991097a059afc9c544b7a1bc7 /lapi.c
parentcfff0135868969de015e5cdcbd50ae7ae3ecc92d (diff)
downloadlua-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.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lapi.c b/lapi.c
index 7e88dc03..680ce9e1 100644
--- a/lapi.c
+++ b/lapi.c
@@ -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
566LUA_API int lua_load (lua_State *L, lua_Getblock getblock, void *ud, 566LUA_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}