xref: /llvm-project/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h (revision ca17571051d4e0a63e702371984dbd3671261f79)
1 //===-- ScriptInterpreterLua.h ----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_Lua_h_
10 #define liblldb_Lua_h_
11 
12 #include "lldb/lldb-types.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Support/Error.h"
15 
16 #include "lua.hpp"
17 
18 #include <mutex>
19 
20 namespace lldb_private {
21 
22 extern "C" {
23 int luaopen_lldb(lua_State *L);
24 }
25 
26 class Lua {
27 public:
28   Lua();
29   ~Lua();
30 
31   llvm::Error Run(llvm::StringRef buffer);
32   llvm::Error LoadModule(llvm::StringRef filename);
33   llvm::Error ChangeIO(FILE *out, FILE *err);
34 
35 private:
36   lua_State *m_lua_state;
37 };
38 
39 } // namespace lldb_private
40 
41 #endif // liblldb_Lua_h_
42