adding context menu function to trashcans
This commit is contained in:
parent
39b7b3a245
commit
5236769fc1
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
11
src/util/Trashcan.ttslua
Normal file
11
src/util/Trashcan.ttslua
Normal file
@ -0,0 +1,11 @@
|
||||
-- adds a context menu entry to trigger the emptying
|
||||
function onLoad()
|
||||
self.addContextMenuItem("Empty Trash", emptyTrash)
|
||||
end
|
||||
|
||||
-- removes all objects by taking them out and then destructing them
|
||||
function emptyTrash()
|
||||
for _, trash in ipairs(self.getObjects()) do
|
||||
self.takeObject().destruct()
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user