Commit Graph

79 Commits (48d4013bcb8102a683545d3e63797a086bc68f44)

Author SHA1 Message Date
Timur Kelman 1d8998de22
allow custom filter in `dfhack.printall_recurse`
Objects with links like `job` output way too much. With this change, it's possible to provide an optional filter and exclude the `list_link`.
```
[lua]# j = dfhack.gui.getSelectedJob()
[lua]# printall_recurse(j, {[tostring(j.list_link)]=true, [tostring(j.pos)]=true})
```
2020-02-23 16:57:57 +01:00
Ben Lubar 96d8dffd32
Make dfhack.run_command return the command_result value.
Rename local variables to match dfhack.run_command_silent for clarity.
2020-01-14 17:53:52 -06:00
Pauli ba1d3fcb6a Add dfhack.printall_recurse to quickly print df containers
I often want to see multiple items quickly when trying to figure out
what states actually matter to an issue that I debug. I decided to make
it easier to quickly dump df structures with substructures and
containers. It will generate large amount of data which can be sometimes
slow to process manually. But processing can be automated using
dfhack-run lua ^<df data to inspect> and pipe to other tools (eg grep,
sed, perl, sort, uniq etc)
2018-06-30 22:31:49 +03:00
lethosor eb199d97b5 Prepend script name to qerror messages, if applicable
Resolves #1282
2018-05-20 09:30:46 -04:00
lethosor 2202c781f7 Add a dfhack.script_help() function to assist scripts 2018-01-25 10:55:00 -05:00
lethosor b1e3c1088c Give loadfile() result a better name for tracebacks 2016-10-19 09:53:12 -04:00
lethosor c2997b9c79 Fix save_dir 2016-08-18 15:47:40 -04:00
Vitaly Pronkin fe18f176f7 More 64-bit fixes
Cherry-picked from 7eb3ba6
- Lua update already done in e2c6350, 4dd411e
- Excluded library/modules/Buildings.cpp
2016-07-26 23:47:53 -04:00
lethosor b36193857c Add string:startswith(), endswith() 2016-04-16 17:13:41 -04:00
lethosor d3dbc6225a Implement getViewscreenByType() in lua 2015-10-17 15:11:04 -04:00
lethosor 9eb86c7e38 Support additional script search paths
These can currently be added/removed from C++ or through the Lua API.
2015-09-06 16:23:02 -04:00
lethosor 862389d217 Allow lua scripts to redirect to other lua scripts
Addresses #634, #638
2015-06-14 11:56:14 -04:00
lethosor bb93f2e40f Fix circular lua script dependencies 2015-06-05 19:08:11 -04:00
lethosor a47a5f8b0a Add an alternative to script_environment() that requires scripts to
recognize use as a module

Also document the use of enable/disable with lua scripts
2015-05-09 09:21:00 -04:00
lethosor 42a6cfaee6 Improve Lua enable/disable error handling 2015-05-08 18:03:19 -04:00
lethosor eaf282c18e Allow lua scripts to be enabled and disabled with built-in commands 2015-05-08 18:03:19 -04:00
lethosor db423c1aa6 Allow Lua scripts to specify whether they can be used as a module or
enabled/disabled
2015-05-08 18:03:18 -04:00
lethosor e73a2f8778 Move script internals to a single table 2015-05-08 18:03:18 -04:00
lethosor 99f4ea4d2b Implement a PenArray class for caching parts of rendered screens 2015-03-27 22:56:30 -04:00
lethosor 37f391ea6d Don't store runScript() in script environments 2015-02-10 17:22:16 -05:00
lethosor 337598e0d6 Restore lua environment persistence and update modified timestamp correctly
See #544
2015-02-10 16:36:21 -05:00
expwnent 712892fb71 Only reload and recompile Lua scripts if they have moved or been updated. 2015-02-02 02:24:43 -05:00
expwnent bf5e491647 Allow Lua scripts to be used as modules. 2015-01-31 22:43:54 -05:00
expwnent aa5d7c11bc Merge remote-tracking branches 'lethosor/patch-12' and 'lethosor/fs-expansion' into develop
Conflicts:
	NEWS
2015-01-31 20:25:01 -05:00
lethosor 3ab558c72d Check for init.lua existence properly
Fixes #501
2015-01-30 16:37:23 -05:00
expwnent 1445b0a919 Allowed Lua scripts to share variables with run_script and corrected dfhack.findScript so that it can find save-specific scripts. 2015-01-26 21:45:31 -05:00
Lethosor d21cd54648 Add '@' documentation to dfhack.lua 2014-09-14 11:50:03 -04:00
lethosor fadca0aef2 Add a variant of printall() that uses ipairs 2014-09-08 20:30:22 -04:00
expwnent 0a16bc2e12 Merge remote-tracking branch 'origin/perSaveScripts' into scriptOrganization
Conflicts:
	plugins/CMakeLists.txt
2014-07-07 09:01:07 -04:00
expwnent 3c06f3bada Allowed per-save script folders. 2014-07-07 08:50:40 -04:00
lethosor 830b39e13b Non-silent version of Lua's run_command 2014-06-27 21:58:36 -04:00
Alexander Gavrilov 6f162a4e72 Verify that mkmodule is called with the correct module name. 2014-06-26 18:11:05 +04:00
lethosor d538e13450 Allow runCommand arguments to be passed as a table internally 2014-06-16 11:16:35 -04:00
lethosor 2a01259192 Fix runCommand crash, return output and result 2014-06-10 21:38:21 -04:00
lethosor 143b1e3469 Lua runCommand improvements
* Return error codes (e.g. CR_FAILURE) when a command fails instead of output
* Make dfhack.runCommand() take a list of arguments as well
2014-06-10 13:41:01 -04:00
lethosor 91a93a00d2 Add dfhack.run_command (Lua)
Simplified version of runCommand
2014-06-07 20:31:20 -04:00
Alexander Gavrilov a09e132107 Support using multiple lua init scripts per save.
This should make it easier to add and remove init script code by
automated means, or install multiple mods that need such code.
2014-03-31 16:00:55 +04:00
Alexander Gavrilov 9e81d27cd1 Implement the same random generator as DF uses for DFHack. 2013-09-30 19:46:39 +04:00
Alexander Gavrilov bb3a491d68 Implement a per-save lua init script. 2012-12-21 14:00:50 +04:00
Alexander Gavrilov d336abfd97 Add label and list widgets, and switch stock dialogs to them. 2012-10-16 14:18:35 +04:00
Alexander Gavrilov 33bd8103de Extract an abstract View superclass from Screen to handle widget trees. 2012-10-15 15:30:00 +04:00
Alexander Gavrilov 57b72831ca Overhaul the concept of lua 'class' initialization yet again. 2012-09-18 20:30:25 +04:00
Alexander Gavrilov 325e294af2 Start the siege engine plugin with code to highlight obstacles on screen. 2012-09-07 19:54:32 +04:00
Alexander Gavrilov d5ea05ebb8 Implement a pressure plate sensitive to machine power.
When built next to a gearbox, it will monitor its powered state.
2012-09-06 12:37:29 +04:00
Alexander Gavrilov 27f169e298 Provide a partial application utility function to lua.
Implemented in C++ for efficiency.
2012-09-05 17:37:36 +04:00
Alexander Gavrilov 296f82b02f Try using the Objective-C 'alloc + init' idiom for lua screen objects. 2012-08-24 13:28:34 +04:00
Alexander Gavrilov c6c5ad56c9 Track lua event listener count, and let the C++ host know.
This allows completely avoiding the call overhead if there
are none. The downside is that the event object now has to
be a userdata with lots of metamethods.
2012-08-23 19:27:28 +04:00
Alexander Gavrilov cacb082416 Add a stupid example of a lua-controlled viewscreen. 2012-08-19 17:53:25 +04:00
Alexander Gavrilov 30f71ff510 Implement support for lua-backed viewscreens. 2012-08-19 14:27:44 +04:00
jj 8e17ebbefc add SC_PAUSED / SC_UNPAUSED onStateChange events 2012-07-05 18:03:02 +02:00