|
|
@@ -24,18 +24,27 @@ void luaRegister_Properties()
|
|
|
{"getMatrix", lua_Properties_getMatrix},
|
|
|
{"getNamespace", lua_Properties_getNamespace},
|
|
|
{"getNextNamespace", lua_Properties_getNextNamespace},
|
|
|
+ {"getNextProperty", lua_Properties_getNextProperty},
|
|
|
{"getQuaternionFromAxisAngle", lua_Properties_getQuaternionFromAxisAngle},
|
|
|
{"getString", lua_Properties_getString},
|
|
|
{"getType", lua_Properties_getType},
|
|
|
+ {"getVariable", lua_Properties_getVariable},
|
|
|
{"getVector2", lua_Properties_getVector2},
|
|
|
{"getVector3", lua_Properties_getVector3},
|
|
|
{"getVector4", lua_Properties_getVector4},
|
|
|
{"rewind", lua_Properties_rewind},
|
|
|
+ {"setString", lua_Properties_setString},
|
|
|
+ {"setVariable", lua_Properties_setVariable},
|
|
|
{NULL, NULL}
|
|
|
};
|
|
|
const luaL_Reg lua_statics[] =
|
|
|
{
|
|
|
{"create", lua_Properties_static_create},
|
|
|
+ {"parseAxisAngle", lua_Properties_static_parseAxisAngle},
|
|
|
+ {"parseColor", lua_Properties_static_parseColor},
|
|
|
+ {"parseVector2", lua_Properties_static_parseVector2},
|
|
|
+ {"parseVector3", lua_Properties_static_parseVector3},
|
|
|
+ {"parseVector4", lua_Properties_static_parseVector4},
|
|
|
{NULL, NULL}
|
|
|
};
|
|
|
std::vector<std::string> scopePath;
|
|
|
@@ -727,6 +736,41 @@ int lua_Properties_getNextNamespace(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_Properties_getNextProperty(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA))
|
|
|
+ {
|
|
|
+ Properties* instance = getInstance(state);
|
|
|
+ const char* result = instance->getNextProperty();
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushstring(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_getNextProperty - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 1).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_Properties_getQuaternionFromAxisAngle(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -913,6 +957,70 @@ int lua_Properties_getType(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_Properties_getVariable(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ Properties* instance = getInstance(state);
|
|
|
+ const char* result = instance->getVariable(param1);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushstring(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_getVariable - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ const char* param2 = gameplay::ScriptUtil::getString(3, false);
|
|
|
+
|
|
|
+ Properties* instance = getInstance(state);
|
|
|
+ const char* result = instance->getVariable(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushstring(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_getVariable - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_Properties_getVector2(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -1092,6 +1200,89 @@ int lua_Properties_rewind(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_Properties_setString(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ const char* param2 = gameplay::ScriptUtil::getString(3, false);
|
|
|
+
|
|
|
+ Properties* instance = getInstance(state);
|
|
|
+ bool result = instance->setString(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_setString - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_Properties_setVariable(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ const char* param2 = gameplay::ScriptUtil::getString(3, false);
|
|
|
+
|
|
|
+ Properties* instance = getInstance(state);
|
|
|
+ instance->setVariable(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_setVariable - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_Properties_static_create(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -1138,4 +1329,262 @@ int lua_Properties_static_create(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_Properties_static_parseAxisAngle(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Quaternion> param2 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 2 to type 'Quaternion'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool result = Properties::parseAxisAngle(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_static_parseAxisAngle - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_Properties_static_parseColor(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ bool result = Properties::parseColor(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ bool result = Properties::parseColor(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_static_parseColor - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_Properties_static_parseVector2(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector2'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool result = Properties::parseVector2(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_static_parseVector2 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_Properties_static_parseVector3(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool result = Properties::parseVector3(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_static_parseVector3 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_Properties_static_parseVector4(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(1, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m2Valid);
|
|
|
+ if (!param2Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector4'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool result = Properties::parseVector4(param1, param2);
|
|
|
+
|
|
|
+ // Push the return value onto the stack.
|
|
|
+ lua_pushboolean(state, result);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_Properties_static_parseVector4 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
}
|