From ed2872cd3bf6d352f36bbd34529738a60b0b51eb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 17 Apr 2019 14:57:29 -0300 Subject: 'require' returns where module was found The function 'require' returns the *loader data* as a second result. For file searchers, this data is the path where they found the module. --- lundump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lundump.c') diff --git a/lundump.c b/lundump.c index a6004933..c1cff9e1 100644 --- a/lundump.c +++ b/lundump.c @@ -271,8 +271,8 @@ static void fchecksize (LoadState *S, size_t size, const char *tname) { #define checksize(S,t) fchecksize(S,sizeof(t),#t) static void checkHeader (LoadState *S) { - /* 1st char already checked */ - checkliteral(S, LUA_SIGNATURE + 1, "not a binary chunk"); + /* skip 1st char (already read and checked) */ + checkliteral(S, &LUA_SIGNATURE[1], "not a binary chunk"); if (LoadInt(S) != LUAC_VERSION) error(S, "version mismatch"); if (LoadByte(S) != LUAC_FORMAT) -- cgit v1.2.3-55-g6feb