Add the sol lua wrapper library

This commit is contained in:
Henrik Rydgård 2024-11-07 18:18:40 +01:00
parent dca6716d71
commit 703c77fd81
5 changed files with 30285 additions and 6 deletions

View File

@ -1,4 +1,5 @@
#include <string>
#include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Core/LuaContext.h"
@ -20,6 +21,9 @@ extern "C" {
#include "ext/lua/lualib.h"
}
// Sol is expensive to include so we only do it here.
#include "ext/sol/sol.hpp"
LuaContext g_lua;
void LuaContext::Init() {
@ -30,11 +34,6 @@ void LuaContext::Init() {
luaopen_table(L);
luaopen_string(L);
luaopen_math(L);
lua_getglobal(L, "_G");
// luaL_register(L, NULL, printlib); // for Lua versions < 5.2
luaL_setfuncs(L, printlib, 0); // for Lua versions 5.2 or greater
lua_pop(L, 1);
}
void LuaContext::Shutdown() {

View File

@ -8,7 +8,6 @@
#include "UI/ImDebugger/ImConsole.h"
#include "Core/LuaContext.h"
ImConsole::ImConsole() {
ClearLog();
memset(InputBuf, 0, sizeof(InputBuf));

53
ext/sol/config.hpp Normal file
View File

@ -0,0 +1,53 @@
// The MIT License (MIT)
// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2022-06-25 08:14:19.336233 UTC
// This header was generated with sol v3.3.0 (revision eba86625)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_CONFIG_HPP
#define SOL_SINGLE_CONFIG_HPP
// beginning of sol/config.hpp
/* Base, empty configuration file!
To override, place a file in your include paths of the form:
. (your include path here)
| sol (directory, or equivalent)
| config.hpp (your config.hpp file)
So that when sol2 includes the file
#include <sol/config.hpp>
it gives you the configuration values you desire. Configuration values can be
seen in the safety.rst of the doc/src, or at
https://sol2.readthedocs.io/en/latest/safety.html ! You can also pass them through
the build system, or the command line options of your compiler.
*/
// end of sol/config.hpp
#endif // SOL_SINGLE_CONFIG_HPP

1321
ext/sol/forward.hpp Normal file

File diff suppressed because it is too large Load Diff

28907
ext/sol/sol.hpp Normal file

File diff suppressed because it is too large Load Diff