Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lua/luvibundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ local function buildBundle(options, bundle)
local compile = options.strip or options.compile

if compile and isLua and name:lower() ~= 'package.lua' then
local fn, err = load(ctx, child)
local fn, err = load(ctx, '@' .. child)
if fn then
ctx = string.dump(fn, options.strip)
elseif not options.force then
Expand Down Expand Up @@ -333,7 +333,7 @@ local function commonBundle(bundlePaths, mainPath, args)
if not path then path = name + ".lua" end
package.preload[name] = function (...)
local lua = assert(bundle.readfile(path))
return assert(loadstring(lua, "bundle:" .. path))(...)
return assert(loadstring(lua, "@bundle:" .. path))(...)
end
end

Expand All @@ -360,7 +360,7 @@ local function commonBundle(bundlePaths, mainPath, args)
else
local main = bundle.readfile(mainPath)
if not main then error("Missing " .. mainPath .. " in " .. bundle.base) end
local fn = assert(loadstring(main, "bundle:" .. mainPath))
local fn = assert(loadstring(main, "@bundle:" .. mainPath))
return fn(unpack(args))
end
end
Expand Down
3 changes: 3 additions & 0 deletions src/luvi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

#if (LUA_VERSION_NUM < 503)
#include "compat-5.3.h"
#ifndef WITH_PLAIN_LUA
#undef luaL_traceback /* luajit has its own version */
#endif
#endif

#ifdef WITH_OPENSSL
Expand Down
16 changes: 1 addition & 15 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,7 @@ int luvi_custom(lua_State* L);
static int luvi_traceback(lua_State *L) {
if (!lua_isstring(L, 1)) /* 'message' not a string? */
return 1; /* keep it intact */
lua_pushglobaltable(L);
lua_getfield(L, -1, "debug");
lua_remove(L, -2);
if (!lua_istable(L, -1)) {
lua_pop(L, 1);
return 1;
}
lua_getfield(L, -1, "traceback");
if (!lua_isfunction(L, -1)) {
lua_pop(L, 2);
return 1;
}
lua_pushvalue(L, 1); /* pass error message */
lua_pushinteger(L, 2); /* skip this function and traceback */
lua_call(L, 2, 1); /* call debug.traceback */
luaL_traceback(L, L, lua_tostring(L, -1), 1);
return 1;
}

Expand Down
Loading