danielga/luapack

"include" does not return a value

Shark-vil opened this issue · 2 comments

function include(filepath)
local time = SysTime()
local obj = GetFileFromPathStack(filepath)
if obj ~= nil then
CompileString(obj:GetContents(), obj:GetFullPath())()
luapack.AddTime(SysTime() - time)
return
end
luapack.DebugMsg("Couldn't include Lua file from luapack, proceeding with normal include", filepath)
luapack.include(filepath)
luapack.AddTime(SysTime() - time)
end


Wiki

https://wiki.facepunch.com/gmod/Global.include


Expected

The result of the script execution (vararg)


Now

Just compiles the code, and does not return the compilation result. There is a chance to break scripts that are dependent on the result of execution. For example:

local BaseClass = include('mod_core/classes/base_class.lua')

Tell me if I'm wrong. 🤔

This is fixed on the develop branch.