diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-11 00:24:40 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-11 00:24:40 -0400 |
commit | 1d9c67f5719b3c55b1f2f2537e796e2ad95e1ac1 (patch) | |
tree | 98e9656f5855a86ed8247ec3dc13e247d617141c /src/script.cpp | |
parent | b46aa08e48bdfa9008738ed5d599d6e7d11ede56 (diff) | |
parent | 2b095e30f7786526da9339ccada3aae7f2ab5df4 (diff) |
Merge branch 'master' of github.com:tcsullivan/gamedev2
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/script.cpp b/src/script.cpp index a6f0968..e3aca3e 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -87,9 +87,12 @@ void ScriptSystem::doFile(void) void ScriptSystem::scriptExport(void) { - std::function<sol::table(sol::table)> func = + std::function<sol::table(sol::table)> entitySpawn = [this](sol::table t){ return spawn(t);}; + std::function<unsigned int(sol::object)> worldRegister = + [this](sol::object t){ return worldSystem.addWorld(t); }; + lua.new_usertype<Position>("Position", sol::constructors<Position(double x, double y), Position()>(), "x", &Position::x, @@ -125,7 +128,8 @@ void ScriptSystem::scriptExport(void) "standing", &Physics::standing); auto gamespace = lua["game"].get_or_create<sol::table>(); - gamespace.set_function("spawn", func); + gamespace.set_function("spawn", entitySpawn); + gamespace.set_function("worldRegister", worldRegister); } sol::table ScriptSystem::spawn(sol::object param) |