diff options
| author | TitanSnow <[email protected]> | 2017-05-24 18:25:01 +0800 |
|---|---|---|
| committer | TitanSnow <[email protected]> | 2017-05-25 08:18:09 +0800 |
| commit | a647f87c9324f735b26cb2f08e32afd1d82357fd (patch) | |
| tree | f6029f570a0af0277e2b4889559b6ee8271a76ec /core/src | |
| parent | b91fc2f5a31c9a7aefbc5585a60b14d6cfa614fa (diff) | |
use luaL_optstring instead of luaL_checkstring in readline.readline for optal arg
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/readline/readline.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/core/src/xmake/readline/readline.c b/core/src/xmake/readline/readline.c index 9684639be..aceae5785 100644 --- a/core/src/xmake/readline/readline.c +++ b/core/src/xmake/readline/readline.c @@ -47,9 +47,7 @@ tb_int_t xm_readline_readline(lua_State* lua) tb_assert_and_check_return_val(lua, 0); // get the prompt - tb_char_t const* prompt = tb_null; - if (tb_strcmp("nil", luaL_typename(lua, 1)) != 0) - prompt = luaL_checkstring(lua, 1); + tb_char_t const* prompt = luaL_optstring(lua, 1, tb_null); // call readline tb_char_t* line = readline(prompt); |
