check parameters for minetest.log lua function
authorsapier <Sapier at GMX dot net>
Sat, 26 Jan 2013 10:32:08 +0000 (10:32 +0000)
committersapier <Sapier at GMX dot net>
Sat, 26 Jan 2013 10:32:08 +0000 (10:32 +0000)
src/scriptapi.cpp

index 8e4a43266c645733a8ef6572fbfaacff8eb44be1..35e708a04749f7fe4ac78dccd99cce6c5e0ba6af 100644 (file)
@@ -4415,8 +4415,8 @@ static int l_log(lua_State *L)
        }
        else
        {
-               std::string levelname = lua_tostring(L, 1);
-               text = lua_tostring(L, 2);
+               std::string levelname = luaL_checkstring(L, 1);
+               text = luaL_checkstring(L, 2);
                if(levelname == "error")
                        level = LMT_ERROR;
                else if(levelname == "action")