diff options
author | Lauri Aarnio <Lauri.Aarnio@iki.fi> | 2008-11-10 19:52:37 +0200 |
---|---|---|
committer | Lauri Leukkunen <lle@rahina.org> | 2008-12-07 04:32:46 +0200 |
commit | cf6479d42f49bc4dbf7db2f8be8e4b50dc4e2768 (patch) | |
tree | 01e6a27c6d93183126628964b663ccaf62060cd9 /luaif | |
parent | ab2e89761025a9f3830988bf8a72e217d7c5018e (diff) |
Fixed mapping mode selection within persistent sessions
Multiple -m, -e and/or -M options can now be specified to "sb2" command when
a persistent session is created (opt. -S). One of those modes can then be
selected when the user joins a session (opt. -J). For example,
"sb2 -S sessionfile -m devel -m emulate"
creates a persistent session which can be used in "devel" and "emulate"
modes. The first listed mode becomes the default.
Examples:
"sb2 -J sessionfile" => devel mode,
"sb2 -J sessionfile -e" => emulate mode,
"sb2 -J sessionfile -m emulate" => emulate mode,
but "sb2 -J sessionfile -m simple" fails, because "simple" was not listed
when the session was created.
Diffstat (limited to 'luaif')
-rw-r--r-- | luaif/luaif.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/luaif/luaif.c b/luaif/luaif.c index 21facef..094ef08 100644 --- a/luaif/luaif.c +++ b/luaif/luaif.c @@ -591,6 +591,14 @@ static int lua_sb_get_binary_name(lua_State *l) return 1; } +/* "sb.get_forced_mapmode", to be called from lua code */ +static int lua_sb_get_forced_mapmode(lua_State *l) +{ + if (sbox_session_mode) lua_pushstring(l, sbox_session_mode); + else lua_pushnil(l); + return 1; +} + /* mappings from c to lua */ static const luaL_reg reg[] = { @@ -607,6 +615,7 @@ static const luaL_reg reg[] = {"debug_messages_enabled", lua_sb_debug_messages_enabled}, {"getcwd", lua_sb_getcwd}, {"get_binary_name", lua_sb_get_binary_name}, + {"get_forced_mapmode", lua_sb_get_forced_mapmode}, {NULL, NULL} }; |