mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 13:09:25 +08:00
37 lines
835 B
C++
37 lines
835 B
C++
#ifndef UTILS_HPP
|
|
#define UTILS_HPP
|
|
|
|
#include <lua/lua.hpp>
|
|
#include <string>
|
|
#include <sol/types.hpp>
|
|
#include <sol/object.hpp>
|
|
#include <sol/table.hpp>
|
|
|
|
#define PTR_ADD(ptr, offset) ((void*)((char*)(ptr) + (offset)))
|
|
|
|
namespace Utils {
|
|
void* get_so_base_address(const std::string& name);
|
|
|
|
lua_State* get_lua_state();
|
|
|
|
namespace Lua {
|
|
std::string get_type_name(sol::type t);
|
|
std::string get_type_name(sol::object& o);
|
|
void print_table_fields_type(sol::table& t);
|
|
void print_traceback(sol::this_state& L);
|
|
void print_object(sol::object& obj);
|
|
}
|
|
|
|
class FuncTrace {
|
|
public:
|
|
FuncTrace(const std::string& func);
|
|
~FuncTrace();
|
|
private:
|
|
std::string m_func;
|
|
};
|
|
}
|
|
|
|
#define FUNC_TRACE() auto _ = Utils::FuncTrace(__FUNCTION__);
|
|
|
|
#endif //UTILS_HPP
|