diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-28 11:22:08 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-28 11:44:55 +0100 |
commit | 0f91bf2a787fe86632491d1cb62dbcee33085cd0 (patch) | |
tree | b341f11b68325ac08b31eff973283cc57066a409 /crawl-ref | |
parent | 4f1035708a954c767ceb4a59f1e23f7547a79620 (diff) | |
download | crawl-ref-0f91bf2a787fe86632491d1cb62dbcee33085cd0.tar.gz crawl-ref-0f91bf2a787fe86632491d1cb62dbcee33085cd0.zip |
Partial lua interpreter.
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/acr.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/luaterp.cc | 33 | ||||
-rw-r--r-- | crawl-ref/source/luaterp.h | 7 | ||||
-rw-r--r-- | crawl-ref/source/makefile.obj | 1 |
4 files changed, 43 insertions, 0 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 26681330ff..5548e9ae3d 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -75,6 +75,7 @@ #include "items.h" #include "lev-pand.h" #include "los.h" +#include "luaterp.h" #include "macro.h" #include "makeitem.h" #include "mapmark.h" @@ -478,6 +479,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail) case CONTROL('H'): wizard_set_hunger_state(); break; case CONTROL('I'): debug_item_statistics(); break; case CONTROL('L'): wizard_set_xl(); break; + case CONTROL('T'): debug_call_dlua(); break; case 'O': debug_test_explore(); break; case 'S': wizard_set_skill_level(); break; diff --git a/crawl-ref/source/luaterp.cc b/crawl-ref/source/luaterp.cc new file mode 100644 index 0000000000..a2c4ec8b42 --- /dev/null +++ b/crawl-ref/source/luaterp.cc @@ -0,0 +1,33 @@ +#include "AppHdr.h" + +#include "luaterp.h" + +#include "cio.h" +#include "clua.h" +#include "dlua.h" + +void _debug_call_lua(lua_State *ls) +{ + char specs[80]; + while (true) + { + mpr("> ", MSGCH_PROMPT); + get_input_line(specs, sizeof(specs)); + std::string s = specs; + + if (s.empty()) + return; + + int err = 0; + if (err = luaL_dostring(ls, s.c_str())) + { + mprf(MSGCH_ERROR, "lua error: %d", err); + } + } +} + +void debug_call_dlua() +{ + _debug_call_lua(dlua); +} + diff --git a/crawl-ref/source/luaterp.h b/crawl-ref/source/luaterp.h new file mode 100644 index 0000000000..aa8cd6b9cf --- /dev/null +++ b/crawl-ref/source/luaterp.h @@ -0,0 +1,7 @@ +#ifndef DEBUGLUA_H +#define DEBUGLUA_H + +void debug_call_dlua(); + +#endif + diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj index c3ac7cb2c1..c65724ce77 100644 --- a/crawl-ref/source/makefile.obj +++ b/crawl-ref/source/makefile.obj @@ -71,6 +71,7 @@ lev-pand.o \ libutil.o \ los.o \ losparam.o \ +luaterp.o \ macro.o \ makeitem.o \ mapdef.o \ |