| 649 | } |
| 650 | |
| 651 | int update_name_style_config(lua_State *L) { |
| 652 | int top = lua_gettop(L); |
| 653 | |
| 654 | if (top != 1) { |
| 655 | return 0; |
| 656 | } |
| 657 | |
| 658 | if (lua_istable(L, 1)) { |
| 659 | try { |
| 660 | InfoTree tree; |
| 661 | auto root = tree.GetRoot(); |
| 662 | lua_pushnil(L); |
| 663 | while (lua_next(L, -2) != 0) { |
| 664 | if (lua_isstring(L, -2)) { |
| 665 | auto key = luaToString(L, -2); |
| 666 | root.AddChild(key, CreateFromLua(tree, L)); |
| 667 | } |
| 668 | lua_pop(L, 1); |
| 669 | } |
| 670 | |
| 671 | LuaCodeFormat::GetInstance().UpdateDiagnosticStyle(tree); |
| 672 | lua_pushboolean(L, true); |
| 673 | return 1; |
| 674 | } catch (std::exception &e) { |
| 675 | std::string err = e.what(); |
| 676 | lua_settop(L, top); |
| 677 | lua_pushboolean(L, false); |
| 678 | lua_pushlstring(L, err.c_str(), err.size()); |
| 679 | return 2; |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | return 0; |
| 684 | } |
| 685 | |
| 686 | int name_style_analysis(lua_State *L) { |
| 687 | int top = lua_gettop(L); |
nothing calls this directly
no test coverage detected