Commit Graph

10 Commits (16ee049664765f2644d2ef83ad15d5ab101cd4e2)

Author SHA1 Message Date
Alexander Gavrilov 125cd6622a Support sorting units in many more ui contexts. 2012-04-22 19:22:00 +04:00
Alexander Gavrilov 3beb2ebf25 Export the onStateChange event to core lua context & add some docs. 2012-04-17 11:45:09 +04:00
Alexander Gavrilov 9c25351281 Add a template to make using lua_pcallk a bit more convenient. 2012-04-16 18:01:21 +04:00
Alexander Gavrilov 3e4863bc80 Integrate coroutines with table-based error handling.
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++.
2012-04-16 14:45:04 +04:00
Alexander Gavrilov 48e4717dd2 Try working around some msvc problems. 2012-04-16 10:59:55 +04:00
Alexander Gavrilov a1756a864c Implement a way to do prompts from core context.
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.
2012-04-15 21:50:22 +04:00
Alexander Gavrilov 14709e5d45 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.
2012-04-15 19:09:25 +04:00
Alexander Gavrilov 2d4af4ac3e A few more utility functions for lua. 2012-04-03 20:02:01 +04:00
Alexander Gavrilov a8fe0eccb4 Add functions for checking validity of lua wrapper objects. 2012-04-02 22:02:04 +04:00
Alexander Gavrilov 0f41608ed4 Pull console output support and REPL out of dfusion into core lib. 2012-03-31 15:40:54 +04:00