diff options
| author | Alexander Gavrilov | 2012-04-15 19:09:25 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-04-15 19:09:25 +0400 |
| commit | 14709e5d4598e11ddce6f9d2cce734528d842ca5 (patch) | |
| tree | b1370d42d766b329b1ce8fc5431b4e7abf04a4b8 /plugins/Dfusion | |
| parent | cb27a1d83916b333d1a0d1b5aa24a7f371e120af (diff) | |
| download | dfhack-14709e5d4598e11ddce6f9d2cce734528d842ca5.tar.gz dfhack-14709e5d4598e11ddce6f9d2cce734528d842ca5.tar.bz2 dfhack-14709e5d4598e11ddce6f9d2cce734528d842ca5.tar.xz | |
Add an official core lua context, and allow plugins to send events to it.
- 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.
Diffstat (limited to 'plugins/Dfusion')
| -rw-r--r-- | plugins/Dfusion/dfusion.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/Dfusion/dfusion.cpp b/plugins/Dfusion/dfusion.cpp index 0886d2a3..cfd2e27c 100644 --- a/plugins/Dfusion/dfusion.cpp +++ b/plugins/Dfusion/dfusion.cpp @@ -121,6 +121,13 @@ command_result lua_run_file (color_ostream &out, std::vector <std::string> ¶ } command_result lua_run (color_ostream &out, std::vector <std::string> ¶meters) { + if (!parameters.empty() && parameters[0] == "--core-context") + { + CoreSuspender suspend; + Lua::InterpreterLoop(out, Lua::Core::State); + return CR_OK; + } + mymutex->lock(); lua::state s=lua::glua::Get(); |
