File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,25 @@ There are the following ways to invoke this command:
27
27
local args = {... }
28
28
local cmd = args [1 ]
29
29
30
+ env = env or {}
31
+ setmetatable (env , {__index = function (self , k )
32
+ if k == ' scr' or k == ' screen' then
33
+ return dfhack .gui .getCurViewscreen ()
34
+ elseif k == ' bld' or k == ' building' then
35
+ return dfhack .gui .getSelectedBuilding ()
36
+ elseif k == ' item' then
37
+ return dfhack .gui .getSelectedItem ()
38
+ elseif k == ' job' then
39
+ return dfhack .gui .getSelectedJob ()
40
+ elseif k == ' wsjob' or k == ' workshop_job' then
41
+ return dfhack .gui .getSelectedWorkshopJob ()
42
+ elseif k == ' unit' then
43
+ return dfhack .gui .getSelectedUnit ()
44
+ else
45
+ return _G [k ]
46
+ end
47
+ end })
48
+
30
49
if cmd == " --file" or cmd == " -f" then
31
50
local f ,err = loadfile (args [2 ])
32
51
if f == nil then
@@ -68,5 +87,5 @@ elseif cmd~=nil then
68
87
end
69
88
end
70
89
else
71
- dfhack .interpreter (" lua" ," lua.history" )
90
+ dfhack .interpreter (" lua" ," lua.history" , env )
72
91
end
You can’t perform that action at this time.
0 commit comments