diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-05-30 15:22:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-05-30 15:22:39 (GMT) |
| commit | 79a27c2c90823f1f9212d80c6b2d63cde620855c (patch) | |
| tree | 04ed2d7542c57446467483447bee6fafea64fbc2 /src/main.c | |
| parent | 5dcc3dbb44f1c721a4adbee3db2dd8b5542e870e (diff) | |
| download | powder-79a27c2c90823f1f9212d80c6b2d63cde620855c.zip powder-79a27c2c90823f1f9212d80c6b2d63cde620855c.tar.gz | |
Basics for Lua
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -58,6 +58,9 @@ #ifdef PYCONSOLE #include "pyconsole.h" #endif +#ifdef LUACONSOLE +#include "luaconsole.h" +#endif pixel *vid_buf; @@ -1560,6 +1563,9 @@ int main(int argc, char *argv[]) fmt.callback = mixaudio; fmt.userdata = NULL; +#ifdef LUACONSOLE + luacon_open(); +#endif #ifdef PYCONSOLE //initialise python console Py_Initialize(); @@ -2366,6 +2372,9 @@ int main(int argc, char *argv[]) } } } +#ifdef LUACONSOLE + luacon_keypress(sdl_key); +#endif #ifdef PYCONSOLE if (pyready==1 && pygood==1) if (pkey!=NULL && sdl_key!=NULL) @@ -3331,6 +3340,20 @@ int main(int argc, char *argv[]) if (!console_mode) hud_enable = 1; } +#elif defined LUACONSOLE + char *console; + sys_pause = 1; + console = console_ui(vid_buf, console_error, console_more); + console = mystrdup(console); + strcpy(console_error,""); + if (process_command_lua(vid_buf, console, console_error)==-1) + { + free(console); + break; + } + free(console); + if (!console_mode) + hud_enable = 1; #else char *console; sys_pause = 1; @@ -3349,6 +3372,9 @@ int main(int argc, char *argv[]) } //execute python step hook +#ifdef LUACONSOLE + luacon_step(); +#endif #ifdef PYCONSOLE if (pyready==1 && pygood==1) if (pstep!=NULL) @@ -3384,6 +3410,9 @@ int main(int argc, char *argv[]) } SDL_CloseAudio(); http_done(); +#ifdef LUACONSOLE + luacon_close(); +#endif #ifdef PYCONSOLE PyRun_SimpleString("import os,tempfile,os.path\ntry:\n os.remove(os.path.join(tempfile.gettempdir(),'tpt_console.py'))\nexcept:\n pass"); |
