aboutsummaryrefslogtreecommitdiffstats
path: root/src/script.cpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-12 18:16:06 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-12 18:16:06 -0400
commit2564533a4860a8452abc27ba05115ca11ed4a787 (patch)
tree67c5dfb2e892f0d492d977b8a5fa42321f2fa4a5 /src/script.cpp
parent8f0db67c5fdbc1e7b8759f44b45ad64caf336cb5 (diff)
Ability to pass world data into Lua
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/script.cpp b/src/script.cpp
index f52391f..7d04375 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -127,6 +127,14 @@ void ScriptSystem::scriptExport(void)
sol::constructors<Physics(void), Physics()>(),
"standing", &Physics::standing);
+ lua.new_usertype<World>("World",
+ sol::constructors<World(sol::object), World(void)>(),
+ "generate", &World::generate,
+ "Seed", sol::property(&World::setSeed, &World::getSeed),
+ "Layers", sol::property(&World::setLayers, &World::getLayers),
+ "setData", &World::setData);
+
+
auto gamespace = lua["game"].get_or_create<sol::table>();
gamespace.set_function("spawn", entitySpawn);
gamespace.set_function("worldRegister", worldRegister);