summaryrefslogtreecommitdiff
path: root/library/LuaTools.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update license, add contributors file, bump release numberPetr Mrázek2012-09-301-2/+2
|
* Search for cur_season and cur_season_tick in devel/find-offsets.Alexander Gavrilov2012-09-221-1/+3
|
* Add stock MessageBox and InputBox dialog screens for lua scripts.Alexander Gavrilov2012-09-051-0/+3
|
* Provide a partial application utility function to lua.Alexander Gavrilov2012-09-051-0/+34
| | | | Implemented in C++ for efficiency.
* Track lua event listener count, and let the C++ host know.Alexander Gavrilov2012-08-231-16/+158
| | | | | | 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.
* Extract the color enum from color_ostream to toplevel.Alexander Gavrilov2012-08-191-1/+1
|
* Support controllable error presentation verbosity in lua code.Alexander Gavrilov2012-06-221-6/+72
| | | | Use qerror to squash stack traces and location prefix.
* Move formatting newly-found globals for symbols.xml to lua code.Alexander Gavrilov2012-06-211-1/+4
|
* Add Lua API for access to some contextual and low-level info.Alexander Gavrilov2012-06-131-3/+3
|
* Support testing and modifying pending timeout callbacks.Alexander Gavrilov2012-05-161-31/+60
|
* Fix some things that confuse MSVC.Alexander Gavrilov2012-05-051-1/+1
|
* Implement timeouts in the core lua context, and quicksave script.Alexander Gavrilov2012-05-041-0/+129
|
* Expose builtin commands to dfhack-run, and add lua script support.Alexander Gavrilov2012-05-041-4/+16
| | | | | Move builtin command implementation to Core methods, and fall back to hack/scripts/*.lua for otherwise unrecognized commands.
* Allow both coordinate object and (x,y,z) as arguments to getTileBlock.Alexander Gavrilov2012-05-021-33/+95
|
* Preserve the original lua global environment for modules.Alexander Gavrilov2012-04-211-6/+39
| | | | | The intent is to prevent accidental pollution of module namespaces by globals defined from careless scripts running in the _G environment.
* Export the onStateChange event to core lua context & add some docs.Alexander Gavrilov2012-04-171-11/+47
|
* Make dfhack.lineedit automatically interact with RunCoreQueryLoop.Alexander Gavrilov2012-04-161-7/+55
| | | | It still falls back to the original waiting mode if yield fails.
* Add a template to make using lua_pcallk a bit more convenient.Alexander Gavrilov2012-04-161-32/+22
|
* Integrate coroutines with table-based error handling.Alexander Gavrilov2012-04-161-54/+214
| | | | | | Properly attach stack traces to errors passing the resume boundary. Replaces coroutine.resume and coroutine.wrap with appropriately modified versions, and adds a Lua::SafeResume function for C++.
* Try working around some msvc problems.Alexander Gavrilov2012-04-161-2/+2
|
* Implement a way to do prompts from core context.Alexander Gavrilov2012-04-151-87/+112
| | | | | | | The trick obviously is doing it without forcing DF to wait suspended. Fortunately, lua has built-in coroutine support, so the interactive prompt can simply yield and rely on the external loop to do the job. To use this however the REPL had to be replaced with lua code.
* Add an official core lua context, and allow plugins to send events to it.Alexander Gavrilov2012-04-151-4/+266
| | | | | | | | | | - This context requires core suspend lock and asserts it in a few places. - Special 'event' objects are introduced. They can be invoked as functions, in which case they iterate all their fields and call them as functions. Errors are printed and consumed. - When a plugin is opened by the core context, events registered in a special array are linked to it. The system is organized so as to avoid even trying to pass the event to lua if the module isn't loaded.
* Allow plugins to export functions to lua with safe reload support.Alexander Gavrilov2012-04-141-0/+17
| | | | | | | | | | | | | | | | | | - To ensure reload safety functions have to be wrapped. Every call checks the loaded state and locks a mutex in Plugin. If the plugin is unloaded, calling its functions throws a lua error. Therefore, plugins may not create closures or export yieldable functions. - The set of function argument and return types supported by LuaWrapper is severely limited when compared to being compiled inside the main library. Currently supported types: numbers, bool, std::string, df::foo, df::foo*, std::vector<bool>, std::vector<df::foo*>. - To facilitate postponing initialization until after all plugins have been loaded, the core sends a SC_CORE_INITIALIZED event. - As an example, the burrows plugin now exports its functions.
* Add a generic facility for object finalization during stack unwind.Alexander Gavrilov2012-04-071-25/+142
| | | | | | | | | Supports two modes of finalization: - try {...} finally {...} - try {...} catch { ...; throw } Argument passing discipline is designed with vararg tail calls in mind.
* Split LuaTools.cpp to separate core utils from general dfhack api.Alexander Gavrilov2012-04-061-275/+3
|
* Export a few more functions to lua.Alexander Gavrilov2012-04-061-3/+32
|
* Wrap a few utility functions defined on the c++ side for lua.Alexander Gavrilov2012-04-051-1/+47
|
* Experimental: try wrapping a dfhack api function.Alexander Gavrilov2012-04-051-0/+6
|
* Upgrade lua errors to structures when attaching stack trace.Alexander Gavrilov2012-04-041-37/+156
| | | | | This allows detecting when it's re-thrown and avoiding attaching the stack twice, and so on. Would also be useful if debugging is added.
* Add color output and input prompt support to core lua api.Alexander Gavrilov2012-04-041-14/+76
|
* A few more utility functions for lua.Alexander Gavrilov2012-04-031-18/+81
|
* Finish documenting the DFHack core lua api existing so far.Alexander Gavrilov2012-04-031-2/+23
|
* Add dfhack.with_suspend(f[, args...]) that calls f with core suspended.Alexander Gavrilov2012-04-011-0/+32
| | | | | The lock is properly removed in case of error, which is then propagated. Just for fun, it also can be yielded from within in a coroutine.
* Only print the shortcut help once in the lua interactive mode.Alexander Gavrilov2012-04-011-6/+11
|
* Improve performance of the persistent data api, and wrap it for lua.Alexander Gavrilov2012-04-011-0/+212
| | | | | | Use an stl table for string keys to avoid linear cost of lookup. This uncovered a bug in the new luaL_getsubtable function.
* Lua tweaks: a couple of functions, dfusion tweak, backtrace metadata.Alexander Gavrilov2012-04-011-1/+1
|
* Pull console output support and REPL out of dfusion into core lib.Alexander Gavrilov2012-03-311-0/+364