summaryrefslogtreecommitdiff
path: root/src/script/common/c_converter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/common/c_converter.cpp')
-rw-r--r--src/script/common/c_converter.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp
index 8f88aeb60..e81cecac8 100644
--- a/src/script/common/c_converter.cpp
+++ b/src/script/common/c_converter.cpp
@@ -51,6 +51,15 @@ if (value < F1000_MIN || value > F1000_MAX) { \
#define CHECK_POS_TAB(index) CHECK_TYPE(index, "position", LUA_TTABLE)
+void push_float_string(lua_State *L, float value)
+{
+ std::stringstream ss;
+ std::string str;
+ ss << value;
+ str = ss.str();
+ lua_pushstring(L, str.c_str());
+}
+
void push_v3f(lua_State *L, v3f p)
{
lua_newtable(L);
@@ -71,6 +80,26 @@ void push_v2f(lua_State *L, v2f p)
lua_setfield(L, -2, "y");
}
+void push_v3_float_string(lua_State *L, v3f p)
+{
+ lua_newtable(L);
+ push_float_string(L, p.X);
+ lua_setfield(L, -2, "x");
+ push_float_string(L, p.Y);
+ lua_setfield(L, -2, "y");
+ push_float_string(L, p.Z);
+ lua_setfield(L, -2, "z");
+}
+
+void push_v2_float_string(lua_State *L, v2f p)
+{
+ lua_newtable(L);
+ push_float_string(L, p.X);
+ lua_setfield(L, -2, "x");
+ push_float_string(L, p.Y);
+ lua_setfield(L, -2, "y");
+}
+
v2s16 read_v2s16(lua_State *L, int index)
{
v2s16 p;