Skip to content

Commit a93c577

Browse files
committed
修加载luaon没自动加return
1 parent 9aaec3d commit a93c577

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fileExtend.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ function FILE.load(path,args,venv)
4949
'string'
5050

5151
if mode=='luaon' then
52-
if s:sub(1,1)~='\27' then s="--[["..STRING.simplifyPath(path)..']]'..(s:match("^%s*[{]") and 'return' or '')..s end
52+
local lackReturn=s:match("^%s*{")
53+
if s:sub(1,1)~='\27' then
54+
s="--[["..STRING.simplifyPath(path)..']]'..(lackReturn and 'return' or '')..s
55+
else
56+
s=(lackReturn and 'return' or '')..s
57+
end
5358
local func,err_mes=loadstring(s)
5459
if func then
5560
setfenv(func,venv or {})

0 commit comments

Comments
 (0)