Lua Scripting (#1334)
Closes #83 Fixes #1309 Fixes #1287 Fixes #1129 (actually fixed now)
This commit is contained in:
27
src/lua/bindings/log.hpp
Normal file
27
src/lua/bindings/log.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
namespace lua::log
|
||||
{
|
||||
static void info(const std::string& data, sol::this_state state)
|
||||
{
|
||||
LOG(INFO) << sol::state_view(state)["!module_name"].get<std::string>() << ": " << data;
|
||||
}
|
||||
|
||||
static void warning(const std::string& data, sol::this_state state)
|
||||
{
|
||||
LOG(WARNING) << sol::state_view(state)["!module_name"].get<std::string>() << ": " << data;
|
||||
}
|
||||
|
||||
static void debug(const std::string& data, sol::this_state state)
|
||||
{
|
||||
LOG(VERBOSE) << sol::state_view(state)["!module_name"].get<std::string>() << ": " << data;
|
||||
}
|
||||
|
||||
static void bind(sol::state& state)
|
||||
{
|
||||
auto ns = state["log"].get_or_create<sol::table>();
|
||||
ns["info"] = info;
|
||||
ns["warning"] = warning;
|
||||
ns["debug"] = debug;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user