summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-08 23:41:48 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-08 23:41:48 +0800
commit7b794f4dfbfe35135fffc78ed5187bbfa5ac1436 (patch)
treea64c98f67721e09d78778eb56b698ab4f039662b /mbbsd
parente6cb3dc46da35de0e371c6ea011929d73321e055 (diff)
downloadpttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar.gz
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar.bz2
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar.lz
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar.xz
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.tar.zst
pttbbs-7b794f4dfbfe35135fffc78ed5187bbfa5ac1436.zip
- bbslua: fixed: pause() return integer (should be string)
- bbslua: fixed: bbs.color() should reset color git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3809 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbslua.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/mbbsd/bbslua.c b/mbbsd/bbslua.c
index a1644756..d41a1e78 100644
--- a/mbbsd/bbslua.c
+++ b/mbbsd/bbslua.c
@@ -39,7 +39,7 @@
// CONST DEFINITION
//////////////////////////////////////////////////////////////////////////
-#define BBSLUA_INTERFACE_VER (0.111)
+#define BBSLUA_INTERFACE_VER (0.112)
#define BBSLUA_SIGNATURE "--#BBSLUA"
// BBS-Lua script format:
@@ -368,7 +368,7 @@ bl_pause(lua_State* L)
abortBBSLua = 1;
return lua_yield(L, 0);
}
- lua_pushinteger(L, n);
+ bl_k2s(L, n);
return 1;
}
@@ -413,6 +413,8 @@ bl_attrset(lua_State *L)
char *p = buf + strlen(buf);
int i = 1;
int n = lua_gettop(L);
+ if (n == 0)
+ outs(ANSI_RESET);
for (i = 1; i <= n; i++)
{
sprintf(p, "%dm",(int)lua_tointeger(L, i));
@@ -750,6 +752,9 @@ bbslua_load_TOC(lua_State *L, const char *pbs, const char *pbe)
if (ps >= pe || *ps++ != ':')
continue;
while (ps < pe && *ps <= ' ') ps++;
+ // special: Interface: vXXXX and XXXX?
+ if (i == 0 && ps < pe && *ps == 'v')
+ ps++;
// finally, (ps, pe) is the value!
if (ps >= pe)
continue;
@@ -854,7 +859,7 @@ bbslua(const char *fpath)
setutmpmode(UMODE_BBSLUA);
bbslua_logo(L);
- vmsgf(" BBS-Lua v%.03f (" __DATE__ " " __TIME__")",
+ vmsgf(" BBS-Lua %.03f (Build " __DATE__ " " __TIME__")",
(double)BBSLUA_INTERFACE_VER);
// ready for running
@@ -863,17 +868,17 @@ bbslua(const char *fpath)
lua_sethook(L, bbsluaHook, LUA_MASKCOUNT, BLCONF_EXEC_COUNT );
refresh();
- while (!abortBBSLua && (r = lua_resume(L, 0)) == LUA_YIELD)
- {
- // check is now done inside hook
- }
+ // check is now done inside hook
+ r = lua_resume(L, 0);
+
+ // even if r == yield, let's abort - you cannot yield main thread.
if (r != 0)
{
const char *errmsg = lua_tostring(L, -1);
move(b_lines-3, 0); clrtobot();
outs("\n");
- outs(errmsg);
+ if (errmsg) outs(errmsg);
}
lua_close(L);