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 "llvm/ADT/StringRef.h"
13 #include "llvm/Support/Error.h"
14 
15 #include "lua.hpp"
16 
17 namespace lldb_private {
18 
19 class Lua {
20 public:
21   Lua() : m_lua_state(luaL_newstate()) {
22     assert(m_lua_state);
23     luaL_openlibs(m_lua_state);
24   }
25 
26   ~Lua() {
27     assert(m_lua_state);
28     luaL_openlibs(m_lua_state);
29   }
30 
31   llvm::Error Run(llvm::StringRef buffer);
32 
33 private:
34   lua_State *m_lua_state;
35 };
36 
37 } // namespace lldb_private
38 
39 #endif // liblldb_Lua_h_
40