locale independent util::parse_double
This commit is contained in:
@@ -101,6 +101,20 @@ void scripting::initialize(Engine* engine) {
|
||||
load_script(fs::path("stdlib.lua"));
|
||||
}
|
||||
|
||||
// todo: luaL state check
|
||||
runnable scripting::create_runnable(
|
||||
const std::string& filename,
|
||||
const std::string& src
|
||||
) {
|
||||
return [=](){
|
||||
if (luaL_loadbuffer(L, src.c_str(), src.length(), filename.c_str())) {
|
||||
handleError(L);
|
||||
return;
|
||||
}
|
||||
call_func(L, 0, filename);
|
||||
};
|
||||
}
|
||||
|
||||
void scripting::on_world_load(Level* level, BlocksController* blocks) {
|
||||
scripting::level = level;
|
||||
scripting::content = level->content;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
#include "../../delegates.h"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class Engine;
|
||||
@@ -20,6 +22,12 @@ namespace scripting {
|
||||
extern BlocksController* blocks;
|
||||
|
||||
void initialize(Engine* engine);
|
||||
|
||||
runnable create_runnable(
|
||||
const std::string& filename,
|
||||
const std::string& source
|
||||
);
|
||||
|
||||
void on_world_load(Level* level, BlocksController* blocks);
|
||||
void on_world_save();
|
||||
void on_world_quit();
|
||||
|
||||
Reference in New Issue
Block a user