mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
fix: lua coroutines support
This commit is contained in:
parent
590f9757c0
commit
7973a9c32b
15 changed files with 707 additions and 740 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "api_lua.hpp"
|
||||
#include "lua_util.hpp"
|
||||
#include "lua_commons.hpp"
|
||||
#include "LuaState.hpp"
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ namespace scripting {
|
|||
using namespace scripting;
|
||||
|
||||
static int l_toml_stringify(lua_State* L) {
|
||||
auto value = state->tovalue(1);
|
||||
auto value = lua::tovalue(L, 1);
|
||||
|
||||
if (auto mapptr = std::get_if<dynamic::Map_sptr>(&value)) {
|
||||
auto string = toml::stringify(**mapptr);
|
||||
|
|
@ -22,11 +23,11 @@ static int l_toml_stringify(lua_State* L) {
|
|||
}
|
||||
}
|
||||
|
||||
static int l_toml_parse(lua_State*) {
|
||||
auto string = state->requireString(1);
|
||||
static int l_toml_parse(lua_State* L) {
|
||||
auto string = lua::require_string(L, 1);
|
||||
auto element = toml::parse("<string>", string);
|
||||
auto value = std::make_unique<dynamic::Value>(element);
|
||||
state->pushvalue(*value);
|
||||
lua::pushvalue(L, *value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue