aboutsummaryrefslogtreecommitdiffstats
path: root/src/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script.cpp b/src/script.cpp
index fa485bc..351aae4 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -57,7 +57,7 @@ void ScriptSystem::receive([[maybe_unused]] const EntitySpawnEvent &toSpawn)
int ScriptSystem::init(void)
{
- lua.open_libraries(sol::lib::base, sol::lib::math);
+ lua.open_libraries(sol::lib::base, sol::lib::math, sol::lib::string);
scriptExport();
doFile();
@@ -176,6 +176,8 @@ sol::table ScriptSystem::spawn(sol::object param)
}
if (tab["Light"] != nullptr) {
+ if (!e.has_component<Position>()) // Position must exist for vel.
+ (*toRet)["Position"] = e.assign<Position>().get();
(*toRet)["Light"] =
e.assign<Light>(Light().FromLua(tab["Light"])).get();
}