Exemple #1
0
	int jass_set(lua_State* L)
	{
		if (!is_gaming())
		{
			return 0;
		}

		const char* name = luaL_checkstring(L, 2);
		jass::global_variable gv(name);
		if (gv.is_vaild())
		{
			if (!gv.is_array())
			{
				gv = jass_read(L, jass::opcode_type_to_var_type(gv.type()), 3);
			}
			else
			{
				switch (gv.type())
				{
				case jass::OPCODE_VARIABLE_INTEGER_ARRAY:
				case jass::OPCODE_VARIABLE_REAL_ARRAY:
				case jass::OPCODE_VARIABLE_STRING_ARRAY:
				case jass::OPCODE_VARIABLE_HANDLE_ARRAY:
				case jass::OPCODE_VARIABLE_BOOLEAN_ARRAY:
					break;
				default:
					break;
				}
			}
		}

		return 0;
	}
Exemple #2
0
	int jarray_newindex(lua_State* L)
	{
		lua::state* ls = (lua::state*)L;
		jass::global_variable gv = jarray_value(ls);
		int32_t index = ls->checkinteger(2);
	
		if (!gv.array_vaild(index))
		{
			return 0;
		}
	
		gv[index] = jass_read(ls, jass::opcode_type_to_var_type(gv.type()), 3);
		return 0;
	}